Lazy load olvy's whats new content #7843
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR configures the olvy script in such a way that it does not load the whole modal iframe on page load. Instead, the modal is lazily initialized upon the user clicking the whats new button.
A important side comment:
The large images are loaded by an iframe created by olvy. The iframe itself seems to have its own limitation of max parallel requests (per domain) (for this claim I found no clear resource but it seemed that way). Thus, I would deduce that the loading of the images was only limiting the amount of inbound data but not the amount of running parallel requests.
=> The performance increase might not be that much.
URL of deployed dev instance (used for testing):
How it works:
The init call to olvy
webknossos/frontend/javascripts/navbar.tsx
Line 116 in 3feb8d5
eagerly initializes the "Whats new" modal as an iframe. This loads all those large gif and other files. To make olvy load it only when needed, the
config.target
needs to be set to""
as the initt function check for exactly that case. Here is the snippet from the olvy script in its init function responsible for the eager loading (this pr now skips that).The
config.target
is then set when the user clicks to open the "What's new" modal.Steps to test:
In case you want to check whether the "how many new updates" number bubble in the top right corner of the button still works, => That is rather difficult 🙈
webknossos/frontend/javascripts/navbar.tsx
Line 136 in 3feb8d5
new Date("1.1.2020").toISOString(),
.To test the lazy loading:
Issues:
(Please delete unneeded items, merge only when none are left open)