cleanup: use RR route module exports to clean up routes.tsx#2545
Merged
david-crespo merged 4 commits intomainfrom Nov 14, 2024
Merged
cleanup: use RR route module exports to clean up routes.tsx#2545david-crespo merged 4 commits intomainfrom
routes.tsx#2545david-crespo merged 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
david-crespo
commented
Nov 12, 2024
| loader={SilosPage.loader} | ||
| handle={makeCrumb('Silos', pb.silos())} | ||
| > | ||
| <Route {...SilosPage} handle={makeCrumb('Silos', pb.silos())}> |
Collaborator
Author
There was a problem hiding this comment.
We could export handle from the module too, but I think that would make it impossible to reason about the crumbs by looking at the config. The components and loaders don’t have this problem.
56d52b6 to
e90f227
Compare
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Nov 14, 2024
oxidecomputer/console@9ef82ba...48fc079 * [48fc079a](oxidecomputer/console@48fc079a) oxidecomputer/console#2542 * [f3d38103](oxidecomputer/console@f3d38103) oxidecomputer/console#2545 * [eba6626d](oxidecomputer/console@eba6626d) bump API for moved system timeseries endpoints * [6052fdbf](oxidecomputer/console@6052fdbf) oxidecomputer/console#2549 * [b886e4b8](oxidecomputer/console@b886e4b8) oxidecomputer/console#2550 * [7303d9d7](oxidecomputer/console@7303d9d7) oxidecomputer/console#2551 * [e239a8e2](oxidecomputer/console@e239a8e2) oxidecomputer/console#2540 * [31520a2e](oxidecomputer/console@31520a2e) move Breadcrumbs component definition into TopBar.tsx * [ad02edec](oxidecomputer/console@ad02edec) minor: extract UserMenu component for readability
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Nov 14, 2024
oxidecomputer/console@9ef82ba...48fc079 * [48fc079a](oxidecomputer/console@48fc079a) oxidecomputer/console#2542 * [f3d38103](oxidecomputer/console@f3d38103) oxidecomputer/console#2545 * [eba6626d](oxidecomputer/console@eba6626d) bump API for moved system timeseries endpoints * [6052fdbf](oxidecomputer/console@6052fdbf) oxidecomputer/console#2549 * [b886e4b8](oxidecomputer/console@b886e4b8) oxidecomputer/console#2550 * [7303d9d7](oxidecomputer/console@7303d9d7) oxidecomputer/console#2551 * [e239a8e2](oxidecomputer/console@e239a8e2) oxidecomputer/console#2540 * [31520a2e](oxidecomputer/console@31520a2e) move Breadcrumbs component definition into TopBar.tsx * [ad02edec](oxidecomputer/console@ad02edec) minor: extract UserMenu component for readability Co-authored-by: iliana etaoin <iliana@oxide.computer>
Open
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.
I didn't bother doing all of them, but I did a bunch of the ones that make the route file shorter as a proof of concept. The route config is really verbose and it makes it a bit unwieldy, especially after #2529. This change is better than it looks in terms of line count because we are adding a few lines outside the route config to save lines inside it:
However, this change has another big advantage besides looking nice: by conforming to RR's route module API, we can trivially convert
<Route {...ProjectsPage}>to<Route lazy={() => import('./pages/ProjectsPage')}to get bundle splitting when and where we want it. This all also will make it easier to convert to the lovely new route config format in React Router v7.Example use of
<Route lazy>