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

OneZoom site hangs with in a JavaScript infinite loop if tree_startpoints table is empty #851

Open
davidebbo opened this issue May 4, 2024 · 7 comments

Comments

@davidebbo
Copy link
Contributor

davidebbo commented May 4, 2024

When just going to http://127.0.0.1:8000/OZtree/, the browser hangs with high CPU if the tree_startpoints table is empty. This appears to be caused by a bug in uikit, but we could potentially work around on our side.

More specifically, in index.html, we have {{for key in carousel:}}. If carousel is an empty list, we end up with no <li> tags, which makes the uk-slider blow up.

@lentinj
Copy link
Collaborator

lentinj commented May 4, 2024

Wrapping the lot in {{if carousel:}}...{{pass}} seems like the easy way out. With the same applying for the other carousels in the same template.

@davidebbo
Copy link
Contributor Author

Wrapping the lot in {{if carousel:}}...{{pass}} seems like the easy way out. With the same applying for the other carousels in the same template.

Right, that should do it. I just reported it minimally to uikit as uikit/uikit#5004. Hopefully, if it gets fixed there, we don't need to change our code, other than upgrading uikit.

Getting from the full hang to the minimal repro was ... a fun time!

@davidebbo
Copy link
Contributor Author

The workaround is to simply add a bogus entry to tree_startpoints. Values can be mostly random, as long as category is homepage_main.

@davidebbo
Copy link
Contributor Author

Good news: the issue was just fixed in uikit. Keeping this open until we update to a uikit with the fix, which will need to be 3.20.9 or later.

@lentinj
Copy link
Collaborator

lentinj commented May 6, 2024

FWIW switching versions is a case of tweaking here and running ./node_modules/.bin/grunt dev:

version_uikit = "3.18.3";

But I wouldn't roll it out without testing the UI, particularly the search / advanced search.

@davidebbo
Copy link
Contributor Author

Thanks @lentinj. Agreed, we'll need to do a good round of testing on the UI. Upgrading is not urgent, as I'm unblocked by adding a dummy tree_startpoints entry.

@hyanwong
Copy link
Member

hyanwong commented May 8, 2024

It wouldn't be a bad idea, IMO, to have {{if carousel:}}...{{else}}Sensible text{{pass}} on the homepage anyway. It can help point the way for anyone installing a new version without stuff in the DB (which includes out future selves).

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

No branches or pull requests

3 participants