Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixed default sort for the content API posts endpoint with included… #20333

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

9larsons
Copy link
Contributor

@9larsons 9larsons commented Jun 5, 2024

… relations

ref https://linear.app/tryghost/issue/CFR-31/

  • when relations were included, erroneous logic resulted in the model's default sort being applied
  • the model default sort is not intended for the content API and needlessly slowed down responses
  • there's a change for users here that should be incredibly unlikely to be hit; default sort is published_at desc which will be secondarily sorted by id desc instead of published_at desc, updated_at desc, id desc

This is a very significant performance improvement for content API requests with includes for sites with a significant amount of data, which will primarily impact those using Ghost as a CMS or theme {{#get}} helpers.

… relations

ref https://linear.app/tryghost/issue/CFR-31/
- when relations were included, erroneous logic resulted in the model's default sort being applied
- the model default sort is not intended for the content API and needlessly slowed down responses
- there's a very minor change for users here; default sort is `published_at desc` which will be secondarily sorted by `id asc` (SQL default for primary key) instead of `published_at desc, updated_at desc, id desc`

This is a very significant performance improvement for content API requests with includes for sites with a significant amount of data, which will primarily impact those using Ghost as a CMS or theme {{#get}} helpers.
@9larsons 9larsons merged commit e49021b into main Jun 5, 2024
22 checks passed
@9larsons 9larsons deleted the content-api-posts-perf-order-fix branch June 5, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant