Repository navigation
Load each plugin section and core screen group on demand - #43
Merged
Merged
Conversation
- lazyScreen fetches a screen when it is first shown, with the loading page while it arrives and a Reload state when its code is gone (for example in a tab left open across a new deployment) - the six file screens become one lazily loaded chunk - src/containers/index.ts is removed: a barrel re-exporting every screen keeps them all in the entry bundle, so each screen is imported from its own file - package.json lists the modules with side effects so unused re-exports of component barrels can be dropped from the build
- deb, rpm, python, ansible, users, groups, roles, tasks, status and signature keys each become one lazily loaded chunk next to file - the layout route is part of the entry instead of a lazy route, so the files index.html names are the whole initial load and the build commit stamp stays in the entry script - the login page, the about page, the placeholders, the not-installed page and the not-found page stay in the entry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
Every plugin section and core screen group is now fetched when it is first shown instead of being part of the entry bundle.
file,deb,rpm,python,ansible,users,groups,roles,tasks,statusandsignature-keys. The login page, the about page, the placeholders, the "plugin not installed" page, the not-found page and the loading page stay in the entry.lazyScreen(load)wrapsReact.lazy: the loading page shows while the code arrives, and a screen whose code cannot be fetched (a tab left open across a new deployment, where every chunk file name changes) shows an error state with a Reload button instead of the router's error page. A rejected import is remembered by React, so the button reloads the page rather than retrying the import.lazy: a signed-out user, or a server without the plugin, never requests the section code.src/containers/index.tsis removed. A barrel that re-exports every screen keeps all of them in the entry bundle, even when they are also imported lazily, so each screen is imported from its own file.package.jsongets asideEffectslist (*.css,*.scss, the entrypoint,l10nanddarkmode, the only side-effect-only imports insrc/), so unused re-exports of the component barrels are dropped from the build.index.htmlnames and made the real initial load larger than the entry looked.ListErrorStatetakes an optional button label.Sizes (production build, gzip level 9)
App.*.js)App.*.css)Section chunks (JS gzip): ansible 14,189, deb 5,383, file 5,244, groups 7,830, python 7,147, roles 6,625, rpm 5,852, signature-keys 4,126, status 4,877, tasks 6,669, users 9,361, plus shared vendor chunks.
The build now reports a few "Conflicting order" warnings between PatternFly component stylesheets that are shared by several chunks. The same rules are all present in the entry stylesheet.
How it is tested
lazy-screen.test.tsx: the loading page then the screen with its props; a rejected load shows "This screen could not be loaded" with a Reload button; pressing Reload callswindow.location.reloadonce.app-routes.test.tsx: the root route is static; deep links to the status screen (signed out) and to a file section screen render once their code has loaded. The existing route and gate tests pass unchanged against the lazy screens.e2e/crawl/routes.test.mjsstill parses the route table, and the message catalogs are refreshed.