Repository navigation
perf: preload the chunks a discussion page shows its posts with - #5333
Merged
Merged
Conversation
When a discussion is the first page opened, its posts wait on the PostStream chunks, which the browser only starts on once forum.js has booted. The page now preloads them alongside the main bundle, through a new Document::preloadChunk() that builds the same versioned address the frontend loads them from.
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.
Fixes: no issue filed.
Changes proposed in this pull request:
A discussion page shows its posts only once the
PostStreamandPostStreamScrubberchunks have loaded. When the discussion is the first page someone opens, the browser only starts on those chunks afterforum.jshas downloaded and booted. That's another round trip, while the page frame sits empty. Core already prefetches both chunks once the app is idle, which covers opening a discussion from inside the app, but that is too late for the first page.The discussion page now has the browser preload both chunks alongside the main bundle.
Document::preloadChunk($namespace, $path)adds the preload with the same versioned address the frontend loads the chunk from, so the preload is reused rather than fetched twice. Extensions can use it for chunks their own routes need straight away. Nothing is added toforum.js.Reviewers should focus on:
forum.jspreloads, so it doesn't compete with them.Necessity
Confirmed
yarn testinjs/). (No frontend changes.)composer test).Required changes: