-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(insights): ensure all links within domain views, stay within domain views #77804
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #77804 +/- ##
==========================================
- Coverage 78.09% 78.08% -0.01%
==========================================
Files 6979 6983 +4
Lines 309716 309826 +110
Branches 50696 50714 +18
==========================================
+ Hits 241862 241919 +57
- Misses 61377 61430 +53
Partials 6477 6477 |
[ModuleName.OTHER]: () => null, | ||
}; | ||
|
||
const ModuleSubpages: Partial<Record<ModuleName, React.ComponentType>> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo, fill this in
This is fine if it's just a temporary change and to help you debug, but I'm not quite following the rationale for having a structure like this. It's understandably more tedious, but in my opinion a much cleaner approach, if we were to stick to the pattern of specifying individual routes. The approach you have here to automatically determine the URL based on the module is smart, but it's a pattern that isn't followed anywhere else in our codebase and has the potential to be difficult to build upon and restricts us if we need to refactor in the future. For the sake of organization, we should prioritize separation of concerns rather than minimizing some code duplication. Here's what I suggest:
Following a design pattern for structuring these pages will greatly improve code readability, discovery, and will be easier to build upon or refactor in the future if needed |
Closing in favour of another approach |
Work for #77572
This ensures any links within a module that is within a domain view, stays within that domain view.
(this means you can now go to the http domain summary, resource summary, etc)
This is only necessary to support existing insights, and domain view work, at the same time. Something to keep in mind, this is all likely to change at somepoint when we remove the flag and do the release, i was trying to be "non-intrusive" as possible with the existing stuff so it works well in two places
This was quite tricky to do, so to make it support both at the same time, i'm using the pathname rather then query params in order to keep track of what page to render. This is because all modules use subpaths to get to their respective summary pages. This all handled in a new component called
ModuleRenderer
which looks at the current url to render the appropriate module page/summary page.There are other approaches to this problem,