Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe changes introduce template variable handling via URL search parameters in the view data management system. A new test file validates ViewContainer's behavior when namespace template variables update through URL changes. The useViewData hook is enhanced to parse URL-prefixed view variables and incorporate them into the query key for proper cache invalidation when variables change. Changes
Sequence DiagramsequenceDiagram
actor User
participant URL as URL/SearchParams
participant ViewContainer
participant useViewData as useViewData Hook
participant QuerySystem as React Query
participant API
User->>URL: Updates viewvar__namespace param
URL->>ViewContainer: Search params change
ViewContainer->>useViewData: Hook re-evaluates
useViewData->>useViewData: Parse URL-prefixed variables<br/>(VIEW_VAR_PREFIX)
useViewData->>useViewData: Build standardModeVariablesKey<br/>(sorted/encoded pairs)
useViewData->>QuerySystem: viewQueryKey updated<br/>(includes variables)
QuerySystem->>API: Fetch view data with new variables
API-->>QuerySystem: Return updated fingerprint
QuerySystem-->>ViewContainer: New data available
ViewContainer->>ViewContainer: Re-render with updated state
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pages/views/hooks/useViewData.ts`:
- Around line 110-116: The aggregated fetch and computed variables are not
receiving updated standard-mode URL variables; when isDisplayPluginMode is
false, pass standardModeVariables into the aggregated variables path and into
useAggregatedViewVariables so sectionData and aggregatedCurrentVariables are
computed with the same template values as the primary getViewDataById refetch;
update the viewQueryKey branch for standard mode to include
standardModeVariables (or the actual variables object) instead of
standardModeVariablesKey and ensure the call site of useAggregatedViewVariables
uses that same variables value when isDisplayPluginMode === false (affecting the
code around viewQueryKey, variables, and the useAggregatedViewVariables
invocation, also mirror the same change at the other block mentioned).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 295fd69e-5f0f-4c54-9ee9-cc368ad48c23
📒 Files selected for processing (2)
src/pages/views/components/__tests__/ViewContainer.templateVariables.unit.test.tsxsrc/pages/views/hooks/useViewData.ts
resolves: #2913
Summary by CodeRabbit
Tests
Bug Fixes