Add loaders to routes with a chainable addLoader - #811
Open
pleek91 wants to merge 2 commits into
Open
Conversation
pleek91
changed the base branch from
loaders-on-matches
to
drop-dead-navigation-guard
August 3, 2026 17:57
Loaders are stored per match alongside views, so a route's data can be derived from its matches the same way its views are.
Loaders are declared the same way views are, and both methods now rebuild through withRouteMethods so chaining one never drops the other. A loader name an ancestor already uses throws, since a route's data combines the loaders of every match.
stackoverfloweth
force-pushed
the
add-loader
branch
from
August 6, 2026 14:18
935ffa1 to
c624559
Compare
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.
Description
Third step of #805, stacked on #809.
Loaders are a route's data, declared the way views are declared but with no component attached and no hold on rendering:
They are stored per match, alongside views, so a route's data can be derived from its matches the same way its views already are — including an ancestor's loaders, which a child should be able to use as its own.
Both chainable methods now rebuild through
withRouteMethods. PreviouslyaddViewre-attached only itself, so chaining a view after a loader would have droppedaddLoaderfrom the route — the two have to be re-attached together, and neither file needs to know about the other for that.A loader name an ancestor already uses throws
LoaderNameConflict. A route's data combines the loaders of every match, so the same name in two places would be ambiguous rather than an override — unlike adding a loader the route itself already has, which replaces it, as views do.Nothing runs a loader yet. What this proves is declaration: names, prefetch configs, immutability, chaining in both orders, and ancestor conflicts.