[perf] Lazy-load ChallengeAuthoring on /challenge/create route#102
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[perf] Lazy-load ChallengeAuthoring on /challenge/create route#102github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Use next/dynamic({ ssr: false }) to split ChallengeAuthoring (1005 lines
across 5 files) from the /challenge/create initial JS bundle. AppHeader,
error Banner, and hooks load instantly; heavy authoring UI streams in
as a separate chunk, reducing Time-to-Interactive for the route.
Also converts the static inline style on the wrapper div
(flex: 1; overflow: hidden) to an .authoringWrapper CSS class.
Test: renderPage() is now async (await act(async () => ...)) so the
React.lazy boundary resolves the mocked import before assertions run.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
|
Pull request created: #102 |
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.
Tier 3 — Loading Optimisation: Code Splitting via
next/dynamicBaseline
The
/challenge/createroute statically importedChallengeAuthoring, bundling all 1 005 lines (across 5 files) into the route's initial JS chunk:authoring-chat.tsxquick-templates.tsxindex.tsxauthoring-message-list.tsxauthoring-input-form.tsxAll of this code was downloaded and parsed before the user could interact with the page header or see any UI.
Fix
Replace the static import with
next/dynamic({ ssr: false }):