Skip to content

Commit 7de8deb

Browse files
committed
fix(integrations): keep fixture integration edits above the shell's per-page remount
The dead-code lane moved IntegrationChanges and IntegrationCenterChanges inside the shell's children, under the ScrollArea keyed by pathname, so every navigation remounted them and dropped the session's integration edits.
1 parent edf1bc2 commit 7de8deb

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

‎apps/sim/app/(product)/_components/product-session.tsx‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import type { ReactNode } from 'react'
3+
import type { ComponentType, ReactNode } from 'react'
44
import { PlatformSurface } from '@sim/emcn-platform/surface/platform-surface'
55
import { useSearchParams } from 'next/navigation'
66
import { SuggestionListProvider } from '@/components/file-viewer/rich-markdown-editor/suggestion-list'
@@ -42,6 +42,11 @@ interface SessionTreeProps extends SessionFrameProps {
4242
theme: Appearance
4343
/** Example data: its scenario resets the session's preferences and edits. */
4444
scenario?: Scenario
45+
/**
46+
* Example data's session edits. They wrap the shell, not the page, because the shell remounts a
47+
* scrolling page on every navigation.
48+
*/
49+
Edits?: ComponentType<{ children: ReactNode }>
4550
}
4651

4752
function SessionTree({
@@ -52,7 +57,13 @@ function SessionTree({
5257
data,
5358
theme,
5459
scenario,
60+
Edits,
5561
}: SessionTreeProps) {
62+
const shell = (
63+
<PlatformShell data={data} banner={banner}>
64+
{children}
65+
</PlatformShell>
66+
)
5667
return (
5768
<SurfaceScopeProvider routePrefix={routePrefix}>
5869
<InterfacePreferences key={scenario}>
@@ -64,9 +75,7 @@ function SessionTree({
6475
<ComposerSession>
6576
<PlatformSurface theme={theme}>
6677
<SuggestionListProvider list={EditorSuggestions}>
67-
<PlatformShell data={data} banner={banner}>
68-
{children}
69-
</PlatformShell>
78+
{Edits ? <Edits>{shell}</Edits> : shell}
7079
</SuggestionListProvider>
7180
</PlatformSurface>
7281
</ComposerSession>
@@ -79,6 +88,14 @@ function SessionTree({
7988
)
8089
}
8190

91+
function FixtureEdits({ children }: { children: ReactNode }) {
92+
return (
93+
<IntegrationChanges>
94+
<IntegrationCenterChanges>{children}</IntegrationCenterChanges>
95+
</IntegrationChanges>
96+
)
97+
}
98+
8299
/**
83100
* A fixture build's session: the scenario, plan and theme its URL selects. Only this path reads the
84101
* query, so a live session never re-renders on a query change.
@@ -109,10 +126,9 @@ export function FixtureProductSession({
109126
}}
110127
theme={readAppearance(search.get('theme'))}
111128
scenario={scenario}
129+
Edits={FixtureEdits}
112130
>
113-
<IntegrationChanges>
114-
<IntegrationCenterChanges>{children}</IntegrationCenterChanges>
115-
</IntegrationChanges>
131+
{children}
116132
</SessionTree>
117133
)
118134
}

0 commit comments

Comments
 (0)