0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/test/unit
Kevin Ansfield 426cbeec0f
🐛 Fixed performance regression introduced in 4.1.0 (#12807)
closes https://github.com/TryGhost/Ghost/issues/12791
closes https://github.com/TryGhost/Team/issues/566

https://github.com/TryGhost/Ghost/pull/12787 introduced a significant performance regression due to a misunderstanding of when Bookshelf calls `.format()` ([related upstream issue](https://github.com/bookshelf/bookshelf/issues/668)). We expected `.format()` to only be called on save but it's also called when Bookshelf performs fetching and eager loading which happens frequently. `.format()` can be a heavy method as it needs to parse and serialize html and markdown so it should be performed as infrequently as possible.

- override `sync()` in the base model so we can call our own `.formatOnWrite()` method to transform attributes on `update` and `insert` operations
  - this was the only feasible location in Bookshelf I could find that is low enough level to not require modifying model instance attributes
  - gives models the option to perform heavy transform operations only when writing to the database compared to the usual `.format()` method that is also called on fetch in many situations
2021-03-23 09:11:24 +00:00
..
adapters Fixed "no-shadow" eslint warning in tests 2020-10-19 17:45:26 +13:00
api 🐛 Fixed __GHOST_URL__ appearing in sitemaps (#12787) 2021-03-18 17:16:37 +00:00
apps 🐛 Fixed __GHOST_URL__ appearing in sitemaps (#12787) 2021-03-18 17:16:37 +00:00
data Updated fixture copy 2021-03-11 19:20:30 +00:00
helpers 🐛 Fixed AMP validation warning from accent color style tag (#12771) 2021-03-17 11:49:42 +00:00
lib 🐛 Fixed images not having srcset or sizes attributes (#12800) 2021-03-20 22:17:43 +00:00
models 🐛 Fixed performance regression introduced in 4.1.0 (#12807) 2021-03-23 09:11:24 +00:00
server Moved notify out of GhostServer 2021-02-19 20:22:56 +00:00
services Fixed failing notification update for non-major version 2021-03-23 18:02:52 +13:00
shared/config Updated tests locations and added linting of core/shared (#11872) 2020-06-01 22:06:50 +01:00
web New logo in Admin (#12768) 2021-03-18 17:27:27 +00:00