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 default ordering on OnlineModView #1303

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Conversation

anttimaki
Copy link
Collaborator

The default order on which the packages are shown on OnlineModView is "whatever was received from the API". Old implementation cached the results in a file, where they could be written and read in the same order. When the cache was moved to IndexedDB, the order was inadvertently changed to "whatever the database returns".

To stay true to the old implementation, order of each package is stored in each entry in the database, so the result set can be ordered by this field. Dexie/IndexedDB doesn't support both filtering and ordering the results on database level, so the ordering is now on JS instead. The alternative would be to fetch all packages in order and filter packages from other communities on JS.

Determining which way is the most efficient is difficult since there seems to be a lot of arbitrary variance in the executions times, at least on the dev build. The performance of the implementation in this commit didn't seem to differ substantially from the unordered implementation, so it was deemed good enough.

The default order on which the packages are shown on OnlineModView is
"whatever was received from the API". Old implementation cached the
results in a file, where they could be written and read in the same
order. When the cache was moved to IndexedDB, the order was
inadvertently changed to "whatever the database returns".

To stay true to the old implementation, order of each package is stored
in each entry in the database, so the result set can be ordered by this
field. Dexie/IndexedDB doesn't support both filtering and ordering the
results on database level, so the ordering is now on JS instead. The
alternative would be to fetch all packages in order and filter packages
from other communities on JS.

Determining which way is the most efficient is difficult since there
seems to be a lot of arbitrary variance in the executions times, at
least on the dev build. The performance of the implementation in this
commit didn't seem to differ substantially from the unordered
implementation, so it was deemed good enough.
@anttimaki anttimaki merged commit 3dc4a63 into develop Apr 24, 2024
7 checks passed
@anttimaki anttimaki deleted the fix-default-ordering branch April 24, 2024 08:23
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