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

Avoid side effects when loading archive #1169

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

Jaifroid
Copy link
Member

This provides better async support for loading archives.

It also provides a whenZimReady function in the loading chain that makes it easier to wait for the ZIM: this will be important for libzim loading (much slower to initialize).

Additionally adds a flag to the ZimArchive object libzimReady, which can be 'loading', 'ready' or 'error'.

@Jaifroid Jaifroid added this to the v4.0 milestone Nov 21, 2023
@Jaifroid Jaifroid self-assigned this Nov 21, 2023
@Jaifroid Jaifroid merged commit e09fe87 into main Nov 21, 2023
9 checks passed
@Jaifroid Jaifroid deleted the Avoid-side-effects-when-loading-archive branch November 21, 2023 07:55
@Jaifroid
Copy link
Member Author

@Rishabhg71 Just so you're aware, this PR (now merged) adds more robust process for loading ZIM archives, and in particular of interest to you will be the whenZimReady funciton added in zimArchive.js. At the moment, this is called after the legacy backend has loaded the ZIM archive, but before libzim is loaded (given that libzim is only used for full-text search currently, so we don't have to wait for its initialization in order to display the landing page of a ZIM).

I suggest you add a param when the user chooses to uses libzim for reading the archive, params.useLibzim (Boolean). You will then be able to add conditionality to the loading in zimArchive.js. If params.useLibzim is true, you should only call whenZimReady() after the .libzimready property is set to 'ready' (that should be obvious in the code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant