-
Notifications
You must be signed in to change notification settings - Fork 193
feat: fix navigation sometimes not working when switching graph #2231
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: fix navigation sometimes not working when switching graph #2231
Conversation
…e to navigate when viewing a check or composition
WalkthroughNormalizes graph route construction with parameterized graph areas; adjusts namespace/workspace search and loading behavior (including a loading placeholder and disabling auto-reconciliation); minor layout height tweaks; consolidates icon imports; adds NamespaceSelector to the feature-flag page layout. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Comment |
…king-when-switching-graph
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
studio/src/components/dashboard/namespace-selector.tsx (1)
9-9: Icon import consolidation improves maintainability.Consolidating the icon imports into a single import statement is a good practice that reduces import clutter and improves code organization.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
studio/src/components/dashboard/graph-command-group.tsx(2 hunks)studio/src/components/dashboard/namespace-selector.tsx(3 hunks)studio/src/components/dashboard/workspace-command-wrapper.tsx(1 hunks)studio/src/components/dashboard/workspace-provider.tsx(2 hunks)studio/src/components/dashboard/workspace-selector.tsx(1 hunks)studio/src/components/layout/title-layout.tsx(1 hunks)studio/src/pages/[organizationSlug]/feature-flags/[featureFlagSlug]/index.tsx(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
studio/src/pages/[organizationSlug]/feature-flags/[featureFlagSlug]/index.tsx (1)
studio/src/components/dashboard/namespace-selector.tsx (1)
NamespaceSelector(19-155)
studio/src/components/dashboard/namespace-selector.tsx (2)
studio/src/hooks/use-workspace.ts (1)
useWorkspace(4-11)studio/src/lib/utils.ts (1)
cn(6-8)
studio/src/components/dashboard/workspace-provider.tsx (1)
connect/src/wg/cosmo/platform/v1/platform_pb.ts (1)
WorkspaceNamespace(20148-20192)
studio/src/components/dashboard/workspace-command-wrapper.tsx (2)
connect/src/wg/cosmo/platform/v1/platform_pb.ts (1)
WorkspaceNamespace(20148-20192)connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go (3)
WorkspaceNamespace(24417-24425)WorkspaceNamespace(24440-24440)WorkspaceNamespace(24455-24457)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build_test
- GitHub Check: build_push_image
- GitHub Check: Analyze (go)
🔇 Additional comments (12)
studio/src/components/dashboard/workspace-selector.tsx (1)
42-42: Layout height adjustment looks appropriate.The removal of
h-9from this wrapper aligns with the coordinated height adjustments across the layout components. This change works in tandem with the addition ofh-9to the breadcrumbs container intitle-layout.tsxto maintain consistent spacing.studio/src/components/layout/title-layout.tsx (1)
46-46: Fixed height addition maintains layout consistency.The addition of
h-9to the breadcrumbs container compensates for the height removal inworkspace-selector.tsx, ensuring consistent layout spacing across the application. This coordinated change prevents layout shifts when switching between different views.studio/src/components/dashboard/graph-command-group.tsx (2)
70-77: Well-defined navigation constants enhance maintainability.The introduction of
defaultGraphTemplateandgraphAreasWithParameterscreates a clear, centralized definition for graph routing logic. This improves maintainability and reduces the likelihood of routing inconsistencies.
94-110: Robust pathname logic addresses navigation issues.The enhanced pathname calculation logic properly handles different routing scenarios:
- Uses
segmentSplitfor more reliable path parsing- Provides fallback to
defaultGraphTemplatewhen not in graph context- Handles parametrized graph areas correctly
- Preserves existing subgraph routing behavior
This addresses the core navigation issue described in the PR title by ensuring consistent route construction.
studio/src/components/dashboard/workspace-command-wrapper.tsx (2)
42-42: Fuse configuration improvements enhance search accuracy.The threshold reduction from 0.3 to 0.2 makes the search more restrictive, and the addition of
includeScore: trueenables score-based sorting, which are both good practices for search optimization.
46-55: Namespace filtering logic is more intuitive.The change to direct case-insensitive substring matching (
wns.name.toLowerCase().includes(filterValue)) for namespace names is more user-friendly than fuzzy search for namespace-level filtering. The addition of the graph count check prevents unnecessary processing for empty namespaces while still allowing name-matched namespaces to be included.studio/src/pages/[organizationSlug]/feature-flags/[featureFlagSlug]/index.tsx (2)
14-14: Import addition supports enhanced navigation.The import of
NamespaceSelectoris correctly added to support the breadcrumb navigation improvements.
93-100: NamespaceSelector integration improves navigation consistency.The addition of
NamespaceSelectoras the first breadcrumb element with appropriate props (isViewingGraphOrSubgraph={false},truncateNamespace) provides consistent navigation experience across different page types. The updated keys maintain proper React reconciliation.studio/src/components/dashboard/namespace-selector.tsx (2)
22-22: Loading state integration enhances user experience.The destructuring of
isLoadingfromuseWorkspaceenables proper loading state handling, which is essential for preventing navigation issues during data transitions.
32-47: Loading state UI provides clear feedback.The loading state implementation with a pulsing animation and proper styling provides good user feedback during data loading. The early return pattern keeps the loading logic clean and separate from the main rendering logic.
studio/src/components/dashboard/workspace-provider.tsx (2)
62-69: Loading-aware namespace memoization prevents stale data issues.The conditional logic that returns a placeholder
WorkspaceNamespacewhenisLoadingis true prevents the component from using potentially stale namespace data during loading states. The inclusion ofisLoadingin the dependency array follows React's best practice of including all reactive values that affect the computation.
35-58: Verify intentional disabling of automatic namespace reconciliationThe useEffect in studio/src/components/dashboard/workspace-provider.tsx (lines 35–58) is commented out; this removes automatic namespace reconciliation and changes namespace-sync behavior, which can cause navigation/state mismatches.
- Action: Confirm this change is intentional and that an alternative sync exists (router.query.namespace handling, setStoredNamespace usage, applyParams usage, or server-side default); add tests or restore reconciliation if not.
- Verification note: automated scan failed with "unrecognized file type: tsx". Run locally and paste results for patterns: rg -nP -C3 'applyParams.*namespace|router.query.namespace|setStoredNamespace|setNamespace' studio and re-run verification if needed.
…king-when-switching-graph
Summary by CodeRabbit
New Features
Style
Checklist