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

fix: add second order by shortUrl when searching for links #2053

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

halfwhole
Copy link
Collaborator

Problem

Bulk-created links with the same createdAt time are not necessarily returned in the same order when sorting links by createdAt only. This may cause issues, like the sort order of bulk links suddenly changing when one of the links is updated

See Notion issue - [Create] Link sort order seems to be changed after adding the tag and Notion issue - [Create] [Update] Link status changes after adding or updating the tag

Solution

Add a second ORDER BY condition on shortUrl, leading to a deterministic ordering with bulk-created links

  • Possible drawback is that the search could take extra time: shortUrl doesn't seem to be an indexed field (but then again, we're currently ordering by createdAt which doesn't seem to be indexed either)
  • But locally at least, searching with 20k links is still super fast

@halfwhole halfwhole merged commit d742231 into develop Nov 16, 2022
@halfwhole halfwhole deleted the fix/search-add-order-by-shorturl branch November 16, 2022 03:39
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.

2 participants