Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(routes): Simplify routing tree using custom route builder #66747

Conversation

evanpurkhiser
Copy link
Member

@evanpurkhiser evanpurkhiser commented Mar 11, 2024

This helps reduce the current complexity of reading the route tree by introducing some logic which builds the two org and orgless routes from a single route.

This only changes the simplest cases. There are a number of more complicated routes that can also be simplified that I will do in a follow up.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 11, 2024
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch from 7ac115c to 0e0d3b5 Compare March 12, 2024 14:37
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch 2 times, most recently from fcab9d3 to 6eabc82 Compare March 12, 2024 17:41
/>
</Route>
</Fragment>
<Route path="/release-thresholds/" withLegacyPath>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the NoOp component is not required and will be added as needed.

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch from 6eabc82 to e6b1208 Compare March 12, 2024 17:45
@evanpurkhiser evanpurkhiser requested a review from a team March 12, 2024 20:29
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch from e6b1208 to 1e2b685 Compare March 12, 2024 20:33
@evanpurkhiser evanpurkhiser changed the title ref(routes): Introduce helper route in routes.tsx ref(routes): Simplify routing tree using custom route builder Mar 12, 2024
Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤸🏻

Comment on lines +204 to +206
// When adding new top-level organization routes, be sure the top level
// route includes withOrgPath to support installs that are not using
// customer domains.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is really important (which it is) might be worth making a component called TopLevelRoute and another called Route so this error is harder to make

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not a bad idea 👍

// traversing the component tree, that is why this logic lives here and not
// inside a custom Route component.
//
// To udnerstand deepr how thsi works, see [0].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// To udnerstand deepr how thsi works, see [0].
// To understand deeper how this works, see [0].

This helps reduce the current complexity of reading the route tree. We
have many route sub-trees that have conditional checks to be
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch from 1e2b685 to 816c56d Compare March 12, 2024 20:49
@evanpurkhiser evanpurkhiser merged commit a936fb0 into master Mar 12, 2024
39 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-routes-introduce-helper-route-in-routes-tsx branch March 12, 2024 21:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants