fix: migrate page navigation pane tabs from Headless UI to Propel#8805
Conversation
📝 WalkthroughWalkthroughRefactored navigation pane tab components to replace HeadlessUI's Tab components with Plane's custom Tabs component. Changes include switching from index-based to string-value-based tab selection, updating handler signatures, and delegating indicator rendering to the new Tabs component API. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/core/components/pages/navigation-pane/root.tsx (1)
75-86:⚠️ Potential issue | 🟡 MinorGuard against
null/undefinedvalue inonValueChangecallback.The
onValueChangecallback from@base-ui-components/reactTabs can passnullorundefined(e.g., when no tab is selected). The Propel Tabs Controlled story demonstrates guarding against this withvalue &&. Without this check, the navigation could be triggered with an invalid value.Proposed fix
const handleTabChange = useCallback( - (value: string) => { + (value: string | null) => { + if (!value) return; const updatedTab = value as TPageNavigationPaneTab; const isUpdatedTabInfo = updatedTab === "info"; const updatedRoute = updateQueryParams({ paramsToAdd: { [PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM]: updatedTab }, paramsToRemove: !isUpdatedTabInfo ? [PAGE_NAVIGATION_PANE_VERSION_QUERY_PARAM] : undefined, }); router.push(updatedRoute); }, [router, updateQueryParams] );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/core/components/pages/navigation-pane/root.tsx` around lines 75 - 86, The handleTabChange callback doesn't guard against null/undefined values from the Tabs onValueChange, which can cause routing with an invalid tab; update handleTabChange to first check that value is non-null/undefined (e.g., if (value == null) return) before casting to TPageNavigationPaneTab and building updatedRoute using PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM, PAGE_NAVIGATION_PANE_VERSION_QUERY_PARAM, updateQueryParams, and router.push so navigation only occurs for valid tab values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/web/core/components/pages/navigation-pane/root.tsx`:
- Around line 75-86: The handleTabChange callback doesn't guard against
null/undefined values from the Tabs onValueChange, which can cause routing with
an invalid tab; update handleTabChange to first check that value is
non-null/undefined (e.g., if (value == null) return) before casting to
TPageNavigationPaneTab and building updatedRoute using
PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM, PAGE_NAVIGATION_PANE_VERSION_QUERY_PARAM,
updateQueryParams, and router.push so navigation only occurs for valid tab
values.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1dea6751-588d-4523-8c99-451ba05c1f75
📒 Files selected for processing (2)
apps/web/core/components/pages/navigation-pane/root.tsxapps/web/core/components/pages/navigation-pane/tabs-list.tsx
Description
Migrates the page navigation pane tabs from
@headlessui/reactTabcomponents to@plane/propel/tabs(Tabs) components. The tab panels (tab-panels/root.tsx) were already usingTabs.Contentfrom Propel, but the parent (root.tsx) and tabs list (tabs-list.tsx) were still using Headless UI'sTab.Group,Tab.List, andTab. This mismatch caused the error:Changes:
root.tsx: ReplacedTab.Groupwith<Tabs value={...} onValueChange={...}>, updated handler from index-based to value-basedtabs-list.tsx: ReplacedTab.List/TabwithTabs.List/Tabs.Trigger/Tabs.IndicatorPAGE_NAVIGATION_PANE_TAB_KEYSimportType of Change
Screenshots and Media (if applicable)
N/A
Test Scenarios
References
N/A
Summary by CodeRabbit