fix: prevent tab synchronization between different records#17559
fix: prevent tab synchronization between different records#17559Weiko merged 7 commits intotwentyhq:mainfrom
Conversation
Include record ID in tab instance ID so that tabs are unique per record, not just per page layout. This prevents tabs from being synchronized when opening two records of the same type in show page and side panel. Fixes twentyhq#17522
LogDetails |
Greptile OverviewGreptile SummaryFixed tab synchronization bug where tabs were shared between different records of the same type when opened in show page and side panel. The root cause was that tab instance IDs were only based on Key Changes:
The fix is simple, focused, and correctly scopes tab state per record instance. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant PageLayoutRenderer
participant LayoutRenderingContext
participant TabListContext
participant TabList
User->>PageLayoutRenderer: Opens Record A in show page
PageLayoutRenderer->>LayoutRenderingContext: useLayoutRenderingContext()
LayoutRenderingContext-->>PageLayoutRenderer: Returns context with recordId A
PageLayoutRenderer->>PageLayoutRenderer: Compute tabListInstanceId<br/>(pageLayoutId-tab-list-recordIdA)
PageLayoutRenderer->>TabListContext: Provide instanceId
TabListContext->>TabList: Render with unique instance ID
User->>PageLayoutRenderer: Opens Record B in side panel
PageLayoutRenderer->>LayoutRenderingContext: useLayoutRenderingContext()
LayoutRenderingContext-->>PageLayoutRenderer: Returns context with recordId B
PageLayoutRenderer->>PageLayoutRenderer: Compute tabListInstanceId<br/>(pageLayoutId-tab-list-recordIdB)
PageLayoutRenderer->>TabListContext: Provide different instanceId
TabListContext->>TabList: Render with separate instance ID
Note over TabList: Tabs remain independent<br/>No synchronization occurs
|
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:33721 This environment will automatically shut down when the PR is closed or after 5 hours. |
useLayoutRenderingContext() throws if context is missing, so it never returns undefined. Only targetRecordIdentifier needs optional chaining since it can be undefined according to the type definition.
This ensures DASHBOARD layouts use the standard tab instance ID without record ID, fixing Storybook test failures while maintaining tab isolation for record pages.
|
hi @Weiko |
Hi, thanks for your contribution. This is most likely a mismatch between your change and PageLayoutRendererContent not computing the instanceId with the recordId |
Create getTabListInstanceIdFromPageLayoutAndRecord utility function to ensure both PageLayoutRenderer and PageLayoutRendererContent compute the tab list instance ID consistently, including record ID for RECORD_PAGE layouts. This fixes the empty page issue caused by instance ID mismatch.
Hi, I have fixed this issue. |
|
Hi, @Weiko |
|
Hi, @Weiko |
Please review my PR again |
|
@Weiko please review my PR |
|
@charlesBochet Please review my PR |
|
Anyone can review this PR? |
|
Hi, @Weiko If you have time, please check my PR again. |
Weiko
left a comment
There was a problem hiding this comment.
Thanks for your contribution. LGTM
Use type-only import for PageLayoutType type annotation and string literal for enum comparison to avoid TypeScript module resolution issues in CI.
…mport issue Use indexed access type LayoutRenderingContextType['layoutType'] instead of directly importing PageLayoutType to avoid TypeScript module resolution errors in CI environment.
|
@github-merge-queue, check merge queue again. |
|
Hi, @Weiko , Please add this PR to merge queue again. I have fixed some for front build check |



Fixes issue where tabs were synchronized when opening two records of the same type in show page and side panel.
The root cause was that tab instance IDs were only based on
pageLayoutId, causing all records using the same page layout to share the same tab state.This change includes the record ID in the tab instance ID, making tabs unique per record while maintaining backward compatibility for cases where no record ID is available.
Fixes #17522