refactor(routes): give the route table a module without components - #8456
Closed
talissoncosta wants to merge 1 commit into
Closed
refactor(routes): give the route table a module without components#8456talissoncosta wants to merge 1 commit into
talissoncosta wants to merge 1 commit into
Conversation
web/routes imports App, so every component reading a path from it forms a cycle. That already cost us once: reading the map at module level in App got an empty object and the app failed to boot, worked around by reading it lazily inside the function. The table moves to web/routePaths, which imports nothing but react-router. web/routes re-exports it, so nothing outside changes, and the three components that wanted a path now take it from there. The lazy read goes with the cycle. isAllowedWhileBlocked moves too, and is now testable without pulling in the app. jest gains the web/ alias webpack already resolves, without which it cannot follow those imports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Changes
Stacked on #8432, which is where
isAllowedWhileBlockedcomes from. Rebase onto main once that merges.web/routesimportsApp, so any component reading a path from it forms a cycle. That already cost us: reading the map at module level inAppgot an empty object and the app failed to boot, worked around by reading it lazily inside the function.The table moves to
web/routePaths, which imports nothing but react-router.web/routesre-exports it, so nothing outside changes, and the three components that only wanted a path take it from there. The lazy read goes with the cycle.isAllowedWhileBlockedmoves too, which makes it testable without pulling in the app. That test is what Themis asked for on #8432: the usage route stays open to a blocked organisation and its neighbours still block.jestgains theweb/alias webpack already resolves. Without it jest cannot follow those imports at all.How did you test this code?
npm run test:unit, 632 tests including the 8 new ones.Worth loading the app once, since a cycle here is the kind of thing only a browser catches.