Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(web): Stack panes on native mobile (#7432)

dev-rb671cd1a87cff
diff --git a/apps/web/src/components/app/mobile/use-mobile-nav.ts b/apps/web/src/components/app/mobile/use-mobile-nav.ts
index c3c1e686a1..eef8bdb2e9 100644
--- a/apps/web/src/components/app/mobile/use-mobile-nav.ts
+++ b/apps/web/src/components/app/mobile/use-mobile-nav.ts
@@ -2,6 +2,7 @@ import type { ListView } from '@app/constants/list-views';
import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';
import { globalSplitManager } from '@app/signal/splitLayout';
import { useSettingsState } from '@core/constant/SettingsState';
+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { type Accessor, createMemo } from 'solid-js';
import { useSplitLayout } from '../split-layout/layout';
import { isMobileNavViewId, type MobileNavViewId } from './mobile-nav-views';
@@ -33,13 +34,14 @@ export function useForegroundMobileView(): Accessor<
}
/**
- * Navigate to a nav view from the pill row. Same semantics as the old dock
- * buttons: switching between navigation views replaces in-place (mergeHistory)
- * so the switch doesn't push a swipe-back entry; from an entity it is forward
- * navigation so the user can swipe back. Settings toggles the settings split.
+ * Navigate to a nav view from the pill row. Native mobile stacks panes, and
+ * the stack resets to just that view: nav views never show a back button,
+ * so nothing may sit behind them.
+ * Otherwise switching between nav views replaces in place (mergeHistory), and
+ * from an entity it navigates forward. Settings toggles the settings split.
*/
export function useMobileNavNavigate(): (id: MobileDockNavId) => void {
- const { openWithSplit } = useSplitLayout();
+ const { openWithSplit, replaceAllSplits } = useSplitLayout();
const { toggleSettings } = useSettingsState();
return (id) => {
@@ -47,8 +49,13 @@ export function useMobileNavNavigate(): (id: MobileDockNavId) => void {
toggleSettings();
return;
}
+ const content = mobileNavContent(id);
+ if (isNativeMobilePlatform()) {
+ replaceAllSplits(content);
+ return;
+ }
const fgContent = globalSplitManager()?.activeSplit()?.content();
const isOnNavView = fgContent?.type === 'component';
- openWithSplit(mobileNavContent(id), { mergeHistory: isOnNavView });
+ openWithSplit(content, { mergeHistory: isOnNavView });
};
}
diff --git a/apps/web/src/components/app/split-layout/SplitLayout.tsx b/apps/web/src/components/app/split-layout/SplitLayout.tsx
index fd174c9ce1..17f656d981 100644
--- a/apps/web/src/components/app/split-layout/SplitLayout.tsx
+++ b/apps/web/src/components/app/split-layout/SplitLayout.tsx
@@ -2,6 +2,7 @@ import { setGlobalSplitManager } from '@app/signal/splitLayout';
import { useSplitRouter } from '@app/split-router';
import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';
import { Resize } from '@core/component/Resize';
+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { tabTitleSignal } from '@core/signal/tabTitle';
import {
@@ -17,6 +18,8 @@ import { PopoverSplitRenderer } from './components/PopoverSplitRenderer';
import { SplitPanel } from './components/SplitPanel';
import { SplitLayoutContext } from './context';
import { createSplitLayout, type SplitId } from './layoutManager';
+import { createMobilePaneStack } from './mobile/createMobilePaneStack';
+import { MobileSplitContainer } from './mobile/MobileSplitContainer';
import {
resolveContentLocation,
splitContentFromLocation,
@@ -33,7 +36,11 @@ export function SplitLayout() {
router,
toLocation: (content) => resolveContentLocation(router.routes, content),
toContent: splitContentFromLocation,
+ stacked: isNativeMobilePlatform,
});
+ const paneStack = isNativeMobilePlatform()
+ ? createMobilePaneStack(splitManager)
+ : undefined;
const [, setTabTitle] = tabTitleSignal;
// Store a ref to each panel by id
@@ -67,38 +74,57 @@ export function SplitLayout() {
return (
<SplitLayoutContext.Provider value={{ manager: splitManager }}>
- <div class="size-full" classList={{ 'py-1.5 pr-1.5': useBentoLayout() }}>
- <Resize.Zone
- direction="horizontal"
- gutter={useBentoLayout() ? 6 : 1}
- showDividers={!useBentoLayout()}
- captureResizeCtx={splitManager.setResizeContext}
- >
- <For each={ids()}>
- {(id, index) => (
- <Show when={splitManager.getSplit(id)}>
- {(handle) => (
- <Suspense>
- <Resize.Panel
- id={id}
- minSize={DEFAULT_SPLIT_MIN_WIDTH}
- index={index()}
- >
- <SplitPanel
- split={splits()[index()]!}
- handle={handle()}
- active={activeSplitSelector(id)}
- setPanelRef={(panelRef) => panelRefs.set(id, panelRef)}
- index={index()}
- />
- </Resize.Panel>
- </Suspense>
+ <Show
+ when={paneStack}
+ fallback={
+ <div
+ class="size-full"
+ classList={{ 'py-1.5 pr-1.5': useBentoLayout() }}
+ >
+ <Resize.Zone
+ direction="horizontal"
+ gutter={useBentoLayout() ? 6 : 1}
+ showDividers={!useBentoLayout()}
+ captureResizeCtx={splitManager.setResizeContext}
+ >
+ <For each={ids()}>
+ {(id, index) => (
+ <Show when={splitManager.getSplit(id)}>
+ {(handle) => (
+ <Suspense>
+ <Resize.Panel
+ id={id}
+ minSize={DEFAULT_SPLIT_MIN_WIDTH}
+ index={index()}
+ >
+ <SplitPanel
+ split={splits()[index()]!}
+ handle={handle()}
+ active={activeSplitSelector(id)}
+ setPanelRef={(panelRef) =>
+ panelRefs.set(id, panelRef)
+ }
+ index={index()}
+ />
+ </Resize.Panel>
+ </Suspense>
+ )}
+ </Show>
)}
- </Show>
- )}
- </For>
- </Resize.Zone>
- </div>
+ </For>
+ </Resize.Zone>
+ </div>
+ }
+ >
+ {(stack) => (
+ <MobileSplitContainer
+ splitManager={splitManager}
+ stack={stack()}
+ splits={splits}
+ panelRefs={panelRefs}
+ />
+ )}
+ </Show>
<PopoverSplitRenderer
popovers={splitManager.popovers}
onClosePopover={(id) => {
diff --git a/apps/web/src/components/app/split-layout/layoutManager.ts b/apps/web/src/components/app/split-layout/layoutManager.ts
index 470ee4412b..264cc44a2c 100644
--- a/apps/web/src/components/app/split-layout/layoutManager.ts
+++ b/apps/web/src/components/app/split-layout/layoutManager.ts
@@ -190,8 +190,6 @@ export type CreateNewSplitOptions = {
allowDuplicate?: boolean;
referredFrom: ReferredFrom;
insertIndex?: number;
- /** Not supported: a new pane starts with only `content`. Kept for the mobile swipe layout. */
- initialHistory?: SplitContent[];
};
export type OpenWithSplitOptions = {
@@ -229,12 +227,6 @@ export type OpenSplitResult = {
| { status: 'navigating'; split?: undefined }
);
-/** Return an outcome to consume navigation, or undefined to use normal split navigation. */
-export type SplitNavigationInterceptor = (
- content: SplitContent,
- options: OpenWithSplitOptions
-) => OpenSplitResult | undefined;
-
export enum SplitEvent {
Insert,
Remove,
@@ -303,6 +295,12 @@ export type SplitLayoutOptions = {
/** The content a router location shows. */
toContent: (location: SplitLocation) => SplitContent;
defaultSplitContent?: SplitContent;
+ /**
+ * Panes stack and only the front one shows, as on native mobile. Opens
+ * add a pane in front unless they merge history, and activating a pane
+ * behind moves it to the front.
+ */
+ stacked?: () => boolean;
};
export type SplitManager = {
@@ -393,29 +391,12 @@ export type SplitManager = {
/** Close all popover splits */
closeAllPopovers: () => void;
- /** Splits not excluded by the current exclusion filter, in order. */
+ /** Splits on screen, in order; stacked panes show only the front one. */
getVisibleSplits: () => SplitState[];
- /** Count of splits not excluded by the current exclusion filter. */
+ /** Count of splits on screen. */
getVisibleSplitCount: () => number;
- /**
- * Register a predicate that marks certain splits as excluded — excluded splits
- * are hidden from external serialization, duplicate detection, and content lookup.
- * Used for mobile swipe back behavior, where we want to ignore the bg split.
- */
- setExclusionFilter: (
- fn: ((split: SplitState) => boolean) | undefined
- ) => void;
-
- /**
- * Register an interceptor for new content and existing standalone splits.
- * If it returns `{ handled: true }` the normal split logic is skipped.
- */
- setSplitNavigationInterceptor: (
- fn: SplitNavigationInterceptor | undefined
- ) => void;
-
/** Get reactive accessor to popovers map */
popovers: () => Map<
string,
@@ -586,6 +567,7 @@ export function createSplitLayout(
options: SplitLayoutOptions
): SplitManager {
const { router, toLocation, toContent, defaultSplitContent } = options;
+ const stacked = () => options.stacked?.() ?? false;
const [state, setState] = createStore<{
splits: SplitState[];
activeSplitId: SplitId | undefined;
@@ -656,9 +638,8 @@ export function createSplitLayout(
const [resizeContext, setResizeContext] = createSignal<ResizeZoneCtx>();
- let exclusionFilter: ((split: SplitState) => boolean) | undefined;
- let splitNavigationInterceptor: SplitNavigationInterceptor | undefined;
- const isExcluded = (split: SplitState) => exclusionFilter?.(split) ?? false;
+ const isFront = (id: SplitId) => state.splits.at(-1)?.id === id;
+ const onScreen = (split: SplitState) => !stacked() || isFront(split.id);
const canAppendSplit = createMemo(
() => resizeContext()?.canFit({ minSize: DEFAULT_SPLIT_MIN_WIDTH }) ?? true
@@ -902,14 +883,14 @@ export function createSplitLayout(
const { replace, referredFrom } = navigateOptions;
const target = { location: toLocation(content) };
- return router.navigate(paneOf(id), target, {
+ return router.navigatePane(paneOf(id), target, {
...entryOptionsOf(content, { referredFrom }),
replace,
});
}
function back(id: SplitId) {
- void router.navigate(paneOf(id), -1);
+ void router.navigatePane(paneOf(id), -1);
}
/**
@@ -931,7 +912,7 @@ export function createSplitLayout(
}
function forward(id: SplitId) {
- void router.navigate(paneOf(id), 1);
+ void router.navigatePane(paneOf(id), 1);
}
function removeFromHistory(
@@ -1109,6 +1090,10 @@ export function createSplitLayout(
})
);
setState('splits', (splits) => splits.filter((s) => s.id !== id));
+ const front = state.splits.at(-1);
+ if (stacked() && state.activeSplitId === id && front) {
+ setState('activeSplitId', front.id);
+ }
dispatchEvent(SplitEvent.Remove, { splitId: id, splitIndex: index });
});
}
@@ -1126,17 +1111,11 @@ export function createSplitLayout(
}
function activateSplit(id: SplitId) {
- // Invariant: an excluded split (the mobile background split) can never
- // become the active split. Promote it out of exclusion first.
- const split = findSplitById(id);
- if (split && isExcluded(split)) {
- if (import.meta.env.DEV) {
- console.warn(
- `activateSplit: refusing to activate excluded split ${id}`
- );
- }
+ if (stacked() && !isFront(id)) {
+ bringToFront(id);
return;
}
+
const current = state.activeSplitId;
setState('lastActiveSplitId', current);
if (state.spotlightId && state.spotlightId !== id) {
@@ -1145,6 +1124,14 @@ export function createSplitLayout(
setState('activeSplitId', id);
}
+ /** Stacked panes bring a pane behind the front forward; the panes that were in front of it stay, behind it. */
+ function bringToFront(id: SplitId) {
+ if (splitIndexById(id) < 0) return;
+
+ router.move(paneOf(id), state.splits.length - 1);
+ activateSplit(id);
+ }
+
function spotlightSplit(id: SplitId) {
if (state.splits.length <= 1) {
return;
@@ -1396,9 +1383,8 @@ export function createSplitLayout(
);
const match = state.splits.find(
(s) =>
- (s.id === instance?.owner ||
- (s.content.type === type && s.content.id === id)) &&
- !isExcluded(s)
+ s.id === instance?.owner ||
+ (s.content.type === type && s.content.id === id)
);
if (!match) return;
return getSplit(match.id);
@@ -1554,7 +1540,9 @@ export function createSplitLayout(
search: options.search,
allowDuplicate: options.allowDuplicate,
};
- const wantsNewPane = options.preferNewSplit === true && canAppendSplit();
+ const wantsNewPane = stacked()
+ ? !options.mergeHistory
+ : options.preferNewSplit === true && canAppendSplit();
const result =
!source || wantsNewPane
@@ -1567,7 +1555,7 @@ export function createSplitLayout(
},
navigateOptions
)
- : router.navigate(paneOf(source.id), target, navigateOptions);
+ : router.navigatePane(paneOf(source.id), target, navigateOptions);
afterNavigation(result, (outcome) => {
const applied = outcome.status !== 'cancelled';
@@ -1587,22 +1575,15 @@ export function createSplitLayout(
const existing = findOpenView(content);
if (options.reopen === 'latest') {
- // Fire-and-forget so it covers every open path (fresh mount, duplicate
- // activation, interceptor-consumed navigation). The block-handle proxy
- // waits for the block and method to register before invoking.
+ // Fire-and-forget so it covers every open path (fresh mount or
+ // duplicate activation). The block-handle proxy waits for the block
+ // and method to register before invoking.
void orchestrator
.getBlockHandle(content.id)
.then((handle) => handle?.goToLatest())
.catch((e) => console.error('openWithSplit: goToLatest failed', e));
}
- // Mobile navigation handles new content and promotes existing top-level
- // splits.
- if (splitNavigationInterceptor && (!existing || existing.topLevelSplit)) {
- const result = splitNavigationInterceptor(content, options);
- if (result) return { ...result, sourceOwner };
- }
-
// Entity views are always reused; only shell components may be duplicated.
const canDuplicateShell =
options.allowDuplicate && existing?.content.type === 'component';
@@ -1651,7 +1632,9 @@ export function createSplitLayout(
const shouldReplaceWhenFull =
options.replaceWhenFull !== false && !canAppendSplit();
- const shouldReplace = !options.preferNewSplit || shouldReplaceWhenFull;
+ const shouldReplace = stacked()
+ ? options.mergeHistory === true
+ : !options.preferNewSplit || shouldReplaceWhenFull;
if (splitHandle && shouldReplace) {
splitHandle.replace({
@@ -1679,6 +1662,7 @@ export function createSplitLayout(
}
}
+ /** Shows `content` as the only split, in one navigation; a split already showing it stays. */
function replaceAllSplits(
content: SplitContent,
options: { referredFrom?: ReferredFrom } = {}
@@ -1689,52 +1673,30 @@ export function createSplitLayout(
openWithSplit(content);
return;
}
- const visibleSplits = state.splits.filter((split) => !isExcluded(split));
- const splitToKeep =
- visibleSplits.find(
- (split) =>
- keyOfSplitContent(split.content) === keyOfSplitContent(content)
- ) ?? visibleSplits[0];
-
- if (!splitToKeep) {
- return createNewSplit({
- content,
- activate: true,
- referredFrom: options.referredFrom ?? null,
- });
- }
- // Atomic for the same reason as SplitHandle.close: no flush between
- // removals, so observers only see the final layout.
- batch(() => {
- for (const split of visibleSplits) {
- if (split.id !== splitToKeep.id) {
- removeSplit(split.id, false);
- }
- }
- });
+ const result = router.navigate(
+ { location: toLocation(content) },
+ entryOptionsOf(content, {
+ referredFrom: options.referredFrom ?? null,
+ activate: true,
+ })
+ );
+ const showAlone = (outcome: NavigationResult) => {
+ if (outcome.status !== 'committed') return;
- const handle = getSplit(splitToKeep.id);
- if (handle) {
- if (
- keyOfSplitContent(splitToKeep.content) !== keyOfSplitContent(content)
- ) {
- handle.replace({
- next: content,
- mergeHistory: false,
- referredFrom: options.referredFrom,
- });
- }
- handle.activate();
+ activateSplit(splitOf(outcome.pane));
unSpotlightSplit();
- return handle;
+ };
+
+ if (result instanceof Promise) {
+ void settleNavigation(result, showAlone);
+ return;
}
- return createNewSplit({
- content,
- activate: true,
- referredFrom: options.referredFrom ?? null,
- });
+ showAlone(result);
+ if (result.status !== 'committed') return;
+
+ return getSplit(splitOf(result.pane));
}
const activeSplit = () => {
@@ -1742,7 +1704,7 @@ export function createSplitLayout(
return id ? getSplit(id) : undefined;
};
- const getVisibleSplits = () => state.splits.filter((s) => !isExcluded(s));
+ const getVisibleSplits = () => state.splits.filter(onScreen);
return {
splits: () => state.splits,
@@ -1779,11 +1741,5 @@ export function createSplitLayout(
getVisibleSplitCount: () => getVisibleSplits().length,
contentNavigationReady: router.ready,
contentNavigationVersion: () => (router.ready() ? 1 : 0),
- setExclusionFilter: (fn) => {
- exclusionFilter = fn;
- },
- setSplitNavigationInterceptor: (fn) => {
- splitNavigationInterceptor = fn;
- },
};
}
diff --git a/apps/web/src/components/app/split-layout/mobile/MobileSplitContainer.tsx b/apps/web/src/components/app/split-layout/mobile/MobileSplitContainer.tsx
index a1338a8784..e4e8f47631 100644
--- a/apps/web/src/components/app/split-layout/mobile/MobileSplitContainer.tsx
+++ b/apps/web/src/components/app/split-layout/mobile/MobileSplitContainer.tsx
@@ -1,6 +1,14 @@
import { ContentLoading } from '@components/app/ContentLoading';
import { useAndroidBackNavigation } from '@core/mobile/androidBack';
-import { type Accessor, createMemo, Show, Suspense } from 'solid-js';
+import {
+ type Accessor,
+ createComputed,
+ createMemo,
+ createSignal,
+ Index,
+ Show,
+ Suspense,
+} from 'solid-js';
import { SplitPanel } from '../components/SplitPanel';
import type {
SplitHandle,
@@ -8,47 +16,68 @@ import type {
SplitManager,
SplitState,
} from '../layoutManager';
+import type { MobilePaneStack } from './createMobilePaneStack';
import { createMobileSplitMotion } from './createMobileSplitMotion';
-import type { MobileSwipeLayout } from './createMobileSwipeLayout';
export type MobileSplitContainerProps = {
splitManager: Pick<SplitManager, 'getSplit'>;
- mobileSwipeLayout: MobileSwipeLayout;
+ stack: MobilePaneStack;
splits: Accessor<ReadonlyArray<SplitState>>;
panelRefs: Map<SplitId, HTMLDivElement>;
};
+type Slots = readonly [SplitId | undefined, SplitId | undefined];
+
+/**
+ * Two fixed slots hold the front pane and the one behind it. A pane keeps
+ * its slot while it changes role, so going forward or back never moves or
+ * remounts it.
+ */
+function createPaneSlots(stack: MobilePaneStack): Accessor<Slots> {
+ const [slots, setSlots] = createSignal<Slots>([undefined, undefined]);
+
+ createComputed(() => {
+ const shown = [stack.behind(), stack.front()].filter(
+ (id): id is SplitId => id !== undefined
+ );
+
+ setSlots(([first, second]) => {
+ const keepFirst = first && shown.includes(first) ? first : undefined;
+ const keepSecond = second && shown.includes(second) ? second : undefined;
+ const free = shown.filter((id) => id !== keepFirst && id !== keepSecond);
+
+ return [keepFirst ?? free.shift(), keepSecond ?? free.shift()];
+ });
+ });
+
+ return slots;
+}
+
export function MobileSplitContainer(props: MobileSplitContainerProps) {
- const { splitManager, mobileSwipeLayout } = props;
+ const { splitManager, stack } = props;
useAndroidBackNavigation(() => {
- if (!mobileSwipeLayout.canGoBack()) return false;
- mobileSwipeLayout.swipeBack();
+ if (!stack.canGoBack()) return false;
+ stack.goBack();
return true;
});
- const motion = createMobileSplitMotion({
- mobileSwipeLayout,
- });
+ const motion = createMobileSplitMotion({ stack });
+ const slots = createPaneSlots(stack);
- const slotDataFor = (slotSplitId: Accessor<SplitId | undefined>) =>
+ const paneFor = (id: SplitId) =>
createMemo(() => {
- const id = slotSplitId();
- if (!id) return undefined;
const split = props.splits().find((s) => s.id === id);
const rawHandle = splitManager.getSplit(id);
if (!split || !rawHandle) return undefined;
const handle: SplitHandle = {
...rawHandle,
- goBack: () => mobileSwipeLayout.swipeBack(),
- canGoBack: () => mobileSwipeLayout.canGoBack(),
+ goBack: () => stack.goBack(),
+ canGoBack: () => stack.canGoBack(),
};
return { split, handle };
});
- const slotAData = slotDataFor(mobileSwipeLayout.slotASplitId);
- const slotBData = slotDataFor(mobileSwipeLayout.slotBSplitId);
-
return (
<div
class="relative size-full overflow-hidden"
@@ -57,73 +86,45 @@ export function MobileSplitContainer(props: MobileSplitContainerProps) {
on:touchend={motion.handleTouchEnd}
on:touchcancel={motion.handleTouchCancel}
>
- <Show when={slotAData()}>
- {(a) => (
- <div
- class={motion.classForSlot(mobileSwipeLayout.fgIsSlotA())}
- style={motion.styleForSlot(mobileSwipeLayout.fgIsSlotA())}
- // The background slot is inert so focus (including programmatic
- // autofocus in late-mounting content) can never land inside the
- // invisible panel. Demoting a slot also blurs any focused child.
- inert={!mobileSwipeLayout.fgIsSlotA()}
- onTransitionEnd={(e) =>
- motion.handleTransitionEnd(e, mobileSwipeLayout.fgIsSlotA())
- }
- >
- {/*
- * Key by split id so SplitPanel remounts when a slot receives a
- * new split — and only then. Content changes inside a split
- * (navigation, or the agent block adopting its real session id
- * mid-typing) swap the mount without tearing the panel down,
- * matching the desktop layout.
- */}
- <Show when={a().split.id} keyed>
- {(_splitId) => (
- <Suspense fallback={<ContentLoading />}>
- <SplitPanel
- split={a().split}
- handle={a().handle}
- active={mobileSwipeLayout.fgIsSlotA()}
- setPanelRef={(ref) =>
- props.panelRefs.set(a().split.id, ref)
- }
- index={0}
- />
- </Suspense>
- )}
- </Show>
- </div>
- )}
- </Show>
+ <Index each={slots()}>
+ {(slotId, index) => (
+ <Show when={slotId()} keyed>
+ {(id) => {
+ const pane = paneFor(id);
+ const isFront = () => stack.front() === id;
+ const isPresented = () => motion.presentedFront() === id;
- <Show when={slotBData()}>
- {(b) => (
- <div
- class={motion.classForSlot(!mobileSwipeLayout.fgIsSlotA())}
- style={motion.styleForSlot(!mobileSwipeLayout.fgIsSlotA())}
- inert={mobileSwipeLayout.fgIsSlotA()}
- onTransitionEnd={(e) =>
- motion.handleTransitionEnd(e, !mobileSwipeLayout.fgIsSlotA())
- }
- >
- <Show when={b().split.id} keyed>
- {(_splitId) => (
- <Suspense fallback={<ContentLoading />}>
- <SplitPanel
- split={b().split}
- handle={b().handle}
- active={!mobileSwipeLayout.fgIsSlotA()}
- setPanelRef={(ref) =>
- props.panelRefs.set(b().split.id, ref)
- }
- index={1}
- />
- </Suspense>
- )}
- </Show>
- </div>
+ return (
+ <Show when={pane()}>
+ {(current) => (
+ <div
+ class={motion.classFor(isFront())}
+ style={motion.styleFor(isFront())}
+ // Only the presented pane is interactive, so focus (including
+ // programmatic autofocus in late-mounting content) can never
+ // land elsewhere. Demoting a pane also blurs any focused child.
+ inert={!isPresented()}
+ onTransitionEnd={(e) =>
+ motion.handleTransitionEnd(e, isFront())
+ }
+ >
+ <Suspense fallback={<ContentLoading />}>
+ <SplitPanel
+ split={current().split}
+ handle={current().handle}
+ active={isPresented()}
+ setPanelRef={(ref) => props.panelRefs.set(id, ref)}
+ index={index}
+ />
+ </Suspense>
+ </div>
+ )}
+ </Show>
+ );
+ }}
+ </Show>
)}
- </Show>
+ </Index>
</div>
);
}
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobileForwardAnimation.ts b/apps/web/src/components/app/split-layout/mobile/createMobileForwardAnimation.ts
index 7958348b70..99196c3e5d 100644
--- a/apps/web/src/components/app/split-layout/mobile/createMobileForwardAnimation.ts
+++ b/apps/web/src/components/app/split-layout/mobile/createMobileForwardAnimation.ts
@@ -1,5 +1,4 @@
-import { batch, createSignal, onCleanup } from 'solid-js';
-import type { MobileSwipeLayout } from './createMobileSwipeLayout';
+import { createSignal, onCleanup } from 'solid-js';
type ForwardAnimationPhase = 'idle' | 'preparing' | 'animating';
@@ -12,9 +11,9 @@ type SplitTransformStyle = {
type MobileForwardAnimationOptions = {
animationMs: number;
bgPeekOffset: number;
- mobileSwipeLayout: MobileSwipeLayout;
};
+/** Slides a pane that just landed in front over the one now behind it. */
export function createMobileForwardAnimation(
options: MobileForwardAnimationOptions
) {
@@ -58,8 +57,6 @@ export function createMobileForwardAnimation(
}
function trigger() {
- if (phase() !== 'idle') return;
-
clearScheduledAnimation();
setPhase('preparing');
scheduleAnimationStart();
@@ -67,28 +64,22 @@ export function createMobileForwardAnimation(
function scheduleAnimationCompletion() {
clearTimeout(forwardCompletionTimer);
- forwardCompletionTimer = setTimeout(() => {
- if (phase() === 'idle') return;
- completeForwardNavigation();
- }, options.animationMs + 250);
+ forwardCompletionTimer = setTimeout(complete, options.animationMs + 250);
}
- function completeForwardNavigation() {
+ function complete() {
if (phase() === 'idle') return;
clearScheduledAnimation();
- batch(() => {
- setPhase('idle');
- options.mobileSwipeLayout.completeNavigateForward();
- });
+ setPhase('idle');
}
- function handleTransitionEnd(e: TransitionEvent, isForeground: boolean) {
+ function handleTransitionEnd(e: TransitionEvent, isFront: boolean) {
if (e.target !== e.currentTarget) return;
- if (isForeground) return;
+ if (!isFront) return;
if (e.propertyName !== 'transform') return;
if (phase() !== 'animating') return;
- completeForwardNavigation();
+ complete();
}
function incomingStyle(): SplitTransformStyle {
@@ -116,14 +107,16 @@ export function createMobileForwardAnimation(
};
}
- function styleForSlot(isForeground: boolean) {
- return isForeground ? outgoingStyle() : incomingStyle();
+ /** The front pane slides in; the pane behind it slides back to its peek offset. */
+ function styleFor(isFront: boolean) {
+ return isFront ? incomingStyle() : outgoingStyle();
}
return {
phase,
trigger,
+ reset: complete,
handleTransitionEnd,
- styleForSlot,
+ styleFor,
};
}
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobilePaneStack.ts b/apps/web/src/components/app/split-layout/mobile/createMobilePaneStack.ts
new file mode 100644
index 0000000000..e51f7bde9a
--- /dev/null
+++ b/apps/web/src/components/app/split-layout/mobile/createMobilePaneStack.ts
@@ -0,0 +1,72 @@
+import { createComputed, on } from 'solid-js';
+import type { SplitId, SplitManager } from '../layoutManager';
+
+/**
+ * Stacked panes on mobile: the front pane shows, and the one behind stays
+ * mounted so swiping back can reveal it. Back always closes the front pane.
+ */
+export type MobilePaneStack = {
+ front: () => SplitId | undefined;
+ behind: () => SplitId | undefined;
+ canGoBack: () => boolean;
+ /** Closes the front pane, animated once the container registers a trigger. */
+ goBack: () => void;
+ /** Closes the front pane now; the container calls it when its swipe finishes. */
+ completeGoBack: () => void;
+ setAnimatedTrigger: (trigger: (() => void) | undefined) => void;
+ /** Runs when another pane comes to the front ahead of `from`, the old front, so the container can slide it in. */
+ setForwardTrigger: (trigger: ((from: SplitId) => void) | undefined) => void;
+};
+
+export function createMobilePaneStack(
+ splitManager: Pick<SplitManager, 'splits' | 'getSplit'>
+): MobilePaneStack {
+ const ids = () => splitManager.splits().map(({ id }) => id);
+ const front = () => ids().at(-1);
+ const behind = () => ids().at(-2);
+ const canGoBack = () => ids().length > 1;
+
+ let animatedTrigger: (() => void) | undefined;
+ let forwardTrigger: ((from: SplitId) => void) | undefined;
+
+ createComputed(
+ on(ids, (next, previous) => {
+ const before = previous?.at(-1);
+ if (!before) return;
+
+ const covered = next.at(-1) !== before && next.includes(before);
+ if (covered) forwardTrigger?.(before);
+ })
+ );
+
+ function completeGoBack() {
+ const id = front();
+ if (!id || !canGoBack()) return;
+
+ splitManager.getSplit(id)?.close();
+ }
+
+ function goBack() {
+ if (!canGoBack()) return;
+ if (animatedTrigger) {
+ animatedTrigger();
+ return;
+ }
+
+ completeGoBack();
+ }
+
+ return {
+ front,
+ behind,
+ canGoBack,
+ goBack,
+ completeGoBack,
+ setAnimatedTrigger: (trigger) => {
+ animatedTrigger = trigger;
+ },
+ setForwardTrigger: (trigger) => {
+ forwardTrigger = trigger;
+ },
+ };
+}
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobileSplitMotion.ts b/apps/web/src/components/app/split-layout/mobile/createMobileSplitMotion.ts
index f3a2f186d2..89678e69a6 100644
--- a/apps/web/src/components/app/split-layout/mobile/createMobileSplitMotion.ts
+++ b/apps/web/src/components/app/split-layout/mobile/createMobileSplitMotion.ts
@@ -1,26 +1,22 @@
import { cn } from '@ui';
-import { onCleanup, onMount } from 'solid-js';
+import { createSignal, onCleanup, onMount } from 'solid-js';
+import type { SplitId } from '../layoutManager';
import { createMobileForwardAnimation } from './createMobileForwardAnimation';
+import type { MobilePaneStack } from './createMobilePaneStack';
import { createMobileSwipeBackGesture } from './createMobileSwipeBackGesture';
-import type { MobileSwipeLayout } from './createMobileSwipeLayout';
const SWIPE_EDGE_THRESHOLD = 40; // px from left edge to initiate gesture
const SWIPE_VELOCITY_THRESHOLD = 0.3; // px/ms - fast flick completes swipe
const SWIPE_DISTANCE_THRESHOLD = 0.5; // fraction of screen width
const SWIPE_ANIMATION_MS = 88;
-const BG_PEEK_OFFSET = 110; // px the BG panel is offset left at rest; closes to 0 as FG slides away
+const BG_PEEK_OFFSET = 110; // px the pane behind is offset left at rest; closes to 0 as the front slides away
-type MobileSplitMotionOptions = {
- mobileSwipeLayout: MobileSwipeLayout;
-};
-
-export function createMobileSplitMotion(options: MobileSplitMotionOptions) {
- const { mobileSwipeLayout } = options;
+export function createMobileSplitMotion(options: { stack: MobilePaneStack }) {
+ const { stack } = options;
const forwardAnimation = createMobileForwardAnimation({
animationMs: SWIPE_ANIMATION_MS,
bgPeekOffset: BG_PEEK_OFFSET,
- mobileSwipeLayout,
});
const swipeBackGesture = createMobileSwipeBackGesture({
animationMs: SWIPE_ANIMATION_MS,
@@ -28,42 +24,44 @@ export function createMobileSplitMotion(options: MobileSplitMotionOptions) {
edgeThreshold: SWIPE_EDGE_THRESHOLD,
velocityThreshold: SWIPE_VELOCITY_THRESHOLD,
distanceThreshold: SWIPE_DISTANCE_THRESHOLD,
- mobileSwipeLayout,
+ stack,
canStart: () => forwardAnimation.phase() === 'idle',
});
+ const [outgoing, setOutgoing] = createSignal<SplitId>();
+
onMount(() => {
- mobileSwipeLayout.setAnimatedTrigger(swipeBackGesture.trigger);
- mobileSwipeLayout.setForwardNavigationTrigger(() => {
+ stack.setAnimatedTrigger(swipeBackGesture.trigger);
+ stack.setForwardTrigger((from) => {
+ setOutgoing(from);
swipeBackGesture.reset();
forwardAnimation.trigger();
});
});
onCleanup(() => {
- mobileSwipeLayout.setAnimatedTrigger(undefined);
- mobileSwipeLayout.setForwardNavigationTrigger(undefined);
+ stack.setAnimatedTrigger(undefined);
+ stack.setForwardTrigger(undefined);
});
- const forwardPhase = forwardAnimation.phase;
- const forwardIsActive = () => forwardPhase() !== 'idle';
+ const forwardIsActive = () => forwardAnimation.phase() !== 'idle';
+
+ /**
+ * The pane presented as the active one. While a pane slides in, the one it
+ * covers stays active, so its floating chrome stays until the slide ends.
+ */
+ const presentedFront = () => (forwardIsActive() ? outgoing() : stack.front());
+
+ function styleFor(isFront: boolean) {
+ if (forwardIsActive()) return forwardAnimation.styleFor(isFront);
- function styleForSlot(isForeground: boolean) {
- if (forwardIsActive()) {
- return forwardAnimation.styleForSlot(isForeground);
- }
- return swipeBackGesture.styleForSlot(isForeground);
+ return swipeBackGesture.styleForSlot(isFront);
}
- function classForSlot(isForeground: boolean) {
+ function classFor(isFront: boolean) {
return cn(
'absolute inset-0',
- {
- 'z-10': isForeground && !forwardIsActive(),
- 'z-0 pointer-events-none': !isForeground && !forwardIsActive(),
- 'z-user-highlight pointer-events-none':
- !isForeground && forwardIsActive(),
- },
- !isForeground &&
+ isFront ? 'z-10' : 'z-0 pointer-events-none',
+ !isFront &&
!swipeBackGesture.isDragging() &&
!swipeBackGesture.isAnimatingOut() &&
!forwardIsActive() &&
@@ -72,8 +70,9 @@ export function createMobileSplitMotion(options: MobileSplitMotionOptions) {
}
return {
- classForSlot,
- styleForSlot,
+ presentedFront,
+ classFor,
+ styleFor,
handleTransitionEnd: forwardAnimation.handleTransitionEnd,
handleTouchStart: swipeBackGesture.handleTouchStart,
handleTouchMove: swipeBackGesture.handleTouchMove,
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeBackGesture.ts b/apps/web/src/components/app/split-layout/mobile/createMobileSwipeBackGesture.ts
index 33168e9061..7c389df1f8 100644
--- a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeBackGesture.ts
+++ b/apps/web/src/components/app/split-layout/mobile/createMobileSwipeBackGesture.ts
@@ -1,5 +1,5 @@
import { batch, createSignal, onCleanup } from 'solid-js';
-import type { MobileSwipeLayout } from './createMobileSwipeLayout';
+import type { MobilePaneStack } from './createMobilePaneStack';
type SplitTransformStyle = {
transform: string;
@@ -13,7 +13,7 @@ type MobileSwipeBackGestureOptions = {
edgeThreshold: number;
velocityThreshold: number;
distanceThreshold: number;
- mobileSwipeLayout: MobileSwipeLayout;
+ stack: MobilePaneStack;
canStart: () => boolean;
};
@@ -68,15 +68,20 @@ export function createMobileSwipeBackGesture(
function trigger() {
if (!options.canStart() || isAnimatingOut()) return;
- if (!options.mobileSwipeLayout.canGoBack()) return;
- animateComplete(() => options.mobileSwipeLayout.completeSwipeBack());
+ if (!options.stack.canGoBack()) return;
+ animateComplete(() => options.stack.completeGoBack());
}
function handleTouchStart(e: TouchEvent) {
if (!options.canStart() || isAnimatingOut()) return;
- if (!options.mobileSwipeLayout.canGoBack()) return;
+ if (!options.stack.canGoBack()) return;
const touch = e.touches[0];
- if (!touch || touch.clientX > options.edgeThreshold) return;
+ if (!touch) return;
+ const left =
+ e.currentTarget instanceof Element
+ ? e.currentTarget.getBoundingClientRect().left
+ : 0;
+ if (touch.clientX - left > options.edgeThreshold) return;
// Buttons can sit inside the swipe-edge zone. If we start the gesture, the preventDefault() in touchmove suppresses the synthesized click on iOS.
if (
e.target instanceof Element &&
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts b/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts
deleted file mode 100644
index bb936f74cf..0000000000
--- a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts
+++ /dev/null
@@ -1,269 +0,0 @@
-import { batch, createSignal, onCleanup } from 'solid-js';
-import type {
- OpenSplitResult,
- OpenWithSplitOptions,
- ReferredFrom,
- SplitContent,
- SplitId,
- SplitManager,
-} from '../layoutManager';
-
-export type MobileSwipeLayout = {
- /** Split ID currently in slot A (may be FG or BG depending on fgIsSlotA). */
- slotASplitId: () => SplitId | undefined;
- /** Split ID currently in slot B (may be FG or BG depending on fgIsSlotA). */
- slotBSplitId: () => SplitId | undefined;
- /** True when slot A is the foreground; false when slot B is the foreground. */
- fgIsSlotA: () => boolean;
- /** True when a background split is available to swipe back to. */
- canGoBack: () => boolean;
- /**
- * Completes a swipe-back. Flips the FG/BG role so the current BG slot becomes FG
- * (no remount for the promoted panel), destroys the old FG, and lazily mounts a
- * new BG from the promoted split's history into the old FG slot.
- * Called by MobileSplitContainer after its animation finishes.
- */
- completeSwipeBack: () => void;
- /** Completes a prepared forward navigation after the swipe-in animation. */
- completeNavigateForward: () => void;
- /**
- * Register an animated trigger provided by MobileSplitContainer.
- * When set, swipeBack() will animate before completing.
- */
- setAnimatedTrigger: (trigger: (() => void) | undefined) => void;
- /**
- * Register an animated forward-navigation trigger. The next split is already
- * prepared in the background slot when this trigger runs.
- */
- setForwardNavigationTrigger: (trigger: (() => void) | undefined) => void;
- /**
- * Initiate a swipe-back — animated if container has registered a trigger,
- * otherwise completes immediately. Called by the split header back button.
- */
- swipeBack: () => void;
-};
-
-export function createMobileSwipeLayout(
- splitManager: SplitManager
-): MobileSwipeLayout {
- // Initialise slot A to whatever the first (only) split is on mobile load.
- const initialFgId = splitManager.splits()[0]?.id;
-
- const [slotASplitId, setSlotASplitId] = createSignal<SplitId | undefined>(
- initialFgId
- );
- const [slotBSplitId, setSlotBSplitId] = createSignal<SplitId | undefined>(
- undefined
- );
- /** When true, slot A is foreground; when false, slot B is foreground. */
- const [fgIsSlotA, setFgIsSlotA] = createSignal(true);
- const toggleFgSlot = () => setFgIsSlotA((prev) => !prev);
-
- let animatedTrigger: (() => void) | undefined;
- let forwardNavigationTrigger: (() => void) | undefined;
- let pendingForwardApplied:
- | { splitId: SplitId; notify: () => void }
- | undefined;
-
- const fgSplitId = () => (fgIsSlotA() ? slotASplitId() : slotBSplitId());
- const bgSplitId = () => (fgIsSlotA() ? slotBSplitId() : slotASplitId());
- const contentKey = (content: SplitContent) => `${content.type}:${content.id}`;
-
- // The BG split is always exactly bgSplitId() — derive exclusion directly from
- // the slot signals rather than maintaining a separate set.
- splitManager.setExclusionFilter((split) => split.id === bgSplitId());
- splitManager.setSplitNavigationInterceptor((content, options) => {
- if (
- options.mergeHistory ||
- splitManager.findOpenView(content)?.owner === fgSplitId()
- )
- return;
- return navigateForward(content, options);
- });
- onCleanup(() => {
- pendingForwardApplied = undefined;
- splitManager.setExclusionFilter(undefined);
- splitManager.setSplitNavigationInterceptor(undefined);
- });
-
- function canGoBack() {
- const bgId = bgSplitId();
- return bgId !== undefined && splitManager.getSplit(bgId) !== undefined;
- }
-
- function navigateForward(
- content: SplitContent,
- options?: Pick<OpenWithSplitOptions, 'referredFrom' | 'onApplied'>
- ): OpenSplitResult {
- pendingForwardApplied = undefined;
- const isFgA = fgIsSlotA();
- const currentFgId = fgSplitId();
- const currentBgId = bgSplitId();
- // New FG content goes into the old BG slot (it becomes FG after the swap).
- const setNewFgSlotId = isFgA ? setSlotBSplitId : setSlotASplitId;
- const referredFrom: ReferredFrom = options?.referredFrom ?? null;
-
- const fgHandle = currentFgId
- ? splitManager.getSplit(currentFgId)
- : undefined;
- const bgHandle = currentBgId
- ? splitManager.getSplit(currentBgId)
- : undefined;
-
- fgHandle?.captureEntryState();
-
- // If the target is already mounted in BG, promote it instead of recreating it.
- if (
- bgHandle &&
- (contentKey(bgHandle.content()) === contentKey(content) ||
- splitManager.findOpenView(content)?.owner === bgHandle.id)
- ) {
- // Reopening from a list supplies a new source even for the same entity.
- bgHandle.replace({
- next:
- contentKey(bgHandle.content()) === contentKey(content)
- ? content
- : bgHandle.content(),
- referredFrom,
- mergeHistory: true,
- });
- const deferred = startForwardNavigation(bgHandle.id, options?.onApplied);
- return deferred
- ? { status: 'navigating' }
- : { status: 'reused', owner: bgHandle.id, split: bgHandle };
- }
-
- const newFgInitialHistory = fgHandle?.history() ?? [];
-
- // Batch to ensure reactive dependencies never see intermediate state.
- const prepared = batch(() => {
- const newFgHandle = splitManager.createNewSplit({
- content,
- initialHistory: newFgInitialHistory,
- activate: false,
- referredFrom,
- });
-
- if (!newFgHandle || newFgHandle.id === currentFgId) return false;
- if (currentBgId && currentBgId !== newFgHandle.id) {
- splitManager.removeSplit(currentBgId);
- }
- setNewFgSlotId(newFgHandle.id);
- return newFgHandle;
- });
- if (!prepared) return { status: 'unavailable' };
-
- const deferred = startForwardNavigation(prepared.id, options?.onApplied);
- return deferred
- ? { status: 'navigating' }
- : { status: 'opened', split: prepared };
- }
-
- function startForwardNavigation(
- splitId: SplitId,
- onApplied?: () => void
- ): boolean {
- if (onApplied) pendingForwardApplied = { splitId, notify: onApplied };
- if (forwardNavigationTrigger) {
- forwardNavigationTrigger();
- return true;
- } else {
- completeNavigateForward();
- return false;
- }
- }
-
- function completeNavigateForward() {
- const preparedFgId = bgSplitId();
- const pending = pendingForwardApplied;
- pendingForwardApplied = undefined;
- if (!preparedFgId || !splitManager.getSplit(preparedFgId)) return;
-
- batch(() => {
- // Flip roles before activating: activateSplit refuses excluded
- // (background) splits, and the prepared split stays excluded until
- // the flip.
- toggleFgSlot();
- splitManager.activateSplit(preparedFgId);
- });
- if (
- pending?.splitId === preparedFgId &&
- splitManager.activeSplitId() === preparedFgId
- ) {
- pending.notify();
- }
- }
-
- function completeSwipeBack() {
- const isFgA = fgIsSlotA();
- const currentFgId = fgSplitId();
- const currentBgId = bgSplitId();
- // New BG content goes into the old FG slot (it becomes BG after the swap).
- const setNewBgSlotId = isFgA ? setSlotASplitId : setSlotBSplitId;
-
- if (!currentBgId) return;
-
- const bgHandle = splitManager.getSplit(currentBgId);
- if (!bgHandle) return;
-
- // Batch to ensure reactive dependencies never see intermediate state.
- batch(() => {
- if (currentFgId) {
- splitManager.removeSplit(currentFgId);
- }
-
- // Skip entries still mounted elsewhere, including an earlier route for
- // the conversation being promoted. Never assign both slots to one split.
- const history = bgHandle.history().slice(0, -1);
- const previousIndex = history.findLastIndex((content) => {
- const existing = splitManager.findOpenView(content);
- return !existing || existing.content.type === 'component';
- });
- const newBgHandle =
- previousIndex >= 0
- ? splitManager.createNewSplit({
- content: history[previousIndex],
- initialHistory: history.slice(0, previousIndex),
- activate: false,
- referredFrom: null,
- })
- : undefined;
-
- setNewBgSlotId(newBgHandle?.id);
- // Flip roles before activating: activateSplit refuses excluded
- // (background) splits, and the promoted split stays excluded until
- // the flip.
- toggleFgSlot();
- splitManager.activateSplit(currentBgId);
- });
- }
-
- function setAnimatedTrigger(trigger: (() => void) | undefined) {
- animatedTrigger = trigger;
- }
-
- function setForwardNavigationTrigger(trigger: (() => void) | undefined) {
- forwardNavigationTrigger = trigger;
- }
-
- function swipeBack() {
- if (!canGoBack()) return;
- if (animatedTrigger) {
- animatedTrigger();
- } else {
- completeSwipeBack();
- }
- }
-
- return {
- slotASplitId,
- slotBSplitId,
- fgIsSlotA,
- canGoBack,
- completeSwipeBack,
- completeNavigateForward,
- setAnimatedTrigger,
- setForwardNavigationTrigger,
- swipeBack,
- };
-}
diff --git a/apps/web/src/components/app/split-layout/split-router/app-pane-policy.ts b/apps/web/src/components/app/split-layout/split-router/app-pane-policy.ts
index 05cd8a5b47..42d0c06ff2 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-pane-policy.ts
+++ b/apps/web/src/components/app/split-layout/split-router/app-pane-policy.ts
@@ -7,8 +7,8 @@ type AppPanePolicyOptions = {
manager: () => SplitManager | undefined;
toContent: (location: SplitLocation) => SplitContent;
defaultLocation: () => SplitLocation;
- /** One pane at a time, as on native mobile; new-pane opens land in the source pane. */
- singlePane: () => boolean;
+ /** Panes stack, as on native mobile: a new pane always goes in front, whatever fits on screen. */
+ stacked: () => boolean;
};
/** A component view other than an agent conversation, which is an entity. */
@@ -37,15 +37,14 @@ export function createAppPanePolicy(
holder,
allowDuplicate,
}) {
- const fallback = source ?? panes.at(-1);
- if (options.singlePane() && fallback) return { pane: holder ?? fallback };
-
const content = options.toContent(destination);
const duplicatesShell = allowDuplicate && isShellComponent(content);
const reuses = holder !== undefined && !duplicatesShell;
if (reuses) return { pane: holder };
+ if (options.stacked()) return { insertAt: panes.length };
// Opens the manager already placed skip the capacity check.
+ const fallback = source ?? panes.at(-1);
const full =
intent.direct !== true && !options.manager()?.canAppendSplit();
if (full && fallback) return { pane: fallback };
diff --git a/apps/web/src/components/app/split-layout/splitFocusTracker.ts b/apps/web/src/components/app/split-layout/splitFocusTracker.ts
index daa372d431..acd57a4667 100644
--- a/apps/web/src/components/app/split-layout/splitFocusTracker.ts
+++ b/apps/web/src/components/app/split-layout/splitFocusTracker.ts
@@ -91,8 +91,8 @@ export function createSplitFocusTracker(props: {
}
let splitWithFocus: SplitId | undefined;
- // Only visible splits may claim activation — the mobile background
- // split is excluded and can never become active.
+ // Only splits on screen may claim activation; on mobile that is the
+ // front pane, not the one mounted behind it.
for (const split of props.splitManager.getVisibleSplits()) {
if (isElementInPanel(split.id, element)) {
splitWithFocus = split.id;
diff --git a/apps/web/src/components/app/split-layout/tests/fixtures.ts b/apps/web/src/components/app/split-layout/tests/fixtures.ts
index 92c1888667..45bd6ea76e 100644
--- a/apps/web/src/components/app/split-layout/tests/fixtures.ts
+++ b/apps/web/src/components/app/split-layout/tests/fixtures.ts
@@ -59,7 +59,7 @@ export function createRoutedSplitLayout(
manager: () => manager,
toContent: splitContentFromLocation,
defaultLocation: () => homeLocation,
- singlePane: () => false,
+ stacked: () => false,
}),
});
manager = createSplitLayout(orchestrator, {
diff --git a/apps/web/src/components/app/split-layout/tests/stacked-panes.test.ts b/apps/web/src/components/app/split-layout/tests/stacked-panes.test.ts
new file mode 100644
index 0000000000..cfd3ad4387
--- /dev/null
+++ b/apps/web/src/components/app/split-layout/tests/stacked-panes.test.ts
@@ -0,0 +1,195 @@
+import { paneRoute } from '@app/routes/app-route';
+import {
+ appRoute,
+ driveSplitRoute,
+ homeSplitRoute,
+ notFoundRoute,
+ settingsRoute,
+} from '@app/routes/routes';
+import {
+ createMemoryHistory,
+ createMemoryPaneStore,
+ createSplitRouter,
+ type Entry,
+ type SplitRoutes,
+} from '@app/split-router';
+import type { BlockOrchestrator } from '@core/orchestrator';
+import { createRoot } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createSplitLayout, type SplitContent } from '../layoutManager';
+import { createMobilePaneStack } from '../mobile/createMobilePaneStack';
+import { createAppPanePolicy } from '../split-router/app-pane-policy';
+import {
+ resolveContentLocation,
+ splitContentFromLocation,
+} from '../split-router/legacy-route';
+
+vi.mock('../componentRegistry', () => ({
+ resolveComponent: vi.fn((id: string, params: Record<string, string>) => ({
+ type: 'mock-component',
+ id,
+ params,
+ })),
+}));
+
+vi.mock('@core/constant/allBlocks', () => ({
+ isBlockAlias: vi.fn(() => false),
+ resolveBlockAlias: vi.fn((type: string) => type),
+}));
+
+vi.mock('@service-storage/websocket', () => ({
+ storageWS: { reconnectIfDisconnected: vi.fn() },
+ createWebSocketJob: vi.fn(),
+}));
+vi.mock('@service-connection/websocket', () => ({
+ ws: { addEventListener: vi.fn(), send: vi.fn() },
+ state: () => 'closed',
+ createConnectionBlockWebsocketEffect: vi.fn(),
+ createConnectionWebsocketEffect: vi.fn(),
+}));
+
+const home: SplitContent = { type: 'component', id: 'home' };
+const settings: SplitContent = { type: 'component', id: 'settings' };
+const documents: SplitContent = { type: 'component', id: 'documents' };
+
+const routes: SplitRoutes = {
+ definitions: [
+ {
+ ...appRoute,
+ children: [homeSplitRoute, settingsRoute, driveSplitRoute, notFoundRoute],
+ },
+ ],
+ defaultRoute: () => paneRoute({ id: 'view-home', params: {} }),
+};
+
+function createMockOrchestrator(): BlockOrchestrator {
+ return {
+ isBlockMounted: vi.fn(() => false),
+ createBlockInstance: vi.fn((_type, id) => ({
+ node: { type: 'mock-node', id },
+ detach: vi.fn(),
+ dispose: vi.fn(),
+ })),
+ } as unknown as BlockOrchestrator;
+}
+
+let dispose: (() => void) | undefined;
+
+function setup(url: string) {
+ const history = createMemoryHistory(url);
+
+ return createRoot((disposeRoot) => {
+ dispose = disposeRoot;
+ let manager: ReturnType<typeof createSplitLayout> | undefined;
+ const router = createSplitRouter({
+ routes,
+ history,
+ paneStore: createMemoryPaneStore<Entry>(),
+ policy: createAppPanePolicy({
+ manager: () => manager,
+ toContent: splitContentFromLocation,
+ defaultLocation: () => ({
+ route: paneRoute({ id: 'view-home', params: {} }),
+ }),
+ stacked: () => true,
+ }),
+ });
+ manager = createSplitLayout(createMockOrchestrator(), {
+ router,
+ toLocation: (content) => resolveContentLocation(router.routes, content),
+ toContent: splitContentFromLocation,
+ stacked: () => true,
+ });
+ const stack = createMobilePaneStack(manager);
+ const shown = () =>
+ manager!.splits().map((split) => split.content.id as string);
+ const active = () => manager!.activeSplit()?.content().id;
+
+ return { history, router, manager, stack, shown, active };
+ });
+}
+
+afterEach(() => {
+ dispose?.();
+ dispose = undefined;
+});
+
+describe('stacked panes', () => {
+ it('opens content in a new pane in front, and going back closes it', () => {
+ const { manager, stack, shown, active } = setup('/home');
+ const forward = vi.fn();
+ stack.setForwardTrigger(forward);
+
+ manager.openWithSplit(settings);
+ expect(shown()).toEqual(['home', 'settings']);
+ expect(active()).toBe('settings');
+ expect(manager.getVisibleSplits().map((split) => split.content.id)).toEqual(
+ ['settings']
+ );
+ expect(forward).toHaveBeenCalledOnce();
+
+ expect(stack.canGoBack()).toBe(true);
+ stack.completeGoBack();
+ expect(shown()).toEqual(['home']);
+ expect(active()).toBe('home');
+ expect(stack.canGoBack()).toBe(false);
+ expect(forward).toHaveBeenCalledOnce();
+ });
+
+ it('replaces the front pane in place when the open merges history', () => {
+ const { manager, shown } = setup('/home');
+ manager.openWithSplit(settings, { mergeHistory: true });
+ expect(shown()).toEqual(['settings']);
+ });
+
+ it('moves a pane behind that already shows the content to the front, in one history entry', () => {
+ const { history, manager, stack, shown, active } = setup('/home');
+ manager.openWithSplit(settings);
+ manager.openWithSplit(documents);
+ expect(shown()).toEqual(['home', 'settings', 'documents']);
+ const entries = history.entries().length;
+ const forward = vi.fn();
+ stack.setForwardTrigger(forward);
+
+ manager.openWithSplit(home);
+ expect(shown()).toEqual(['settings', 'documents', 'home']);
+ expect(active()).toBe('home');
+ expect(history.entries()).toHaveLength(entries + 1);
+ expect(forward).toHaveBeenCalledOnce();
+
+ stack.completeGoBack();
+ expect(shown()).toEqual(['settings', 'documents']);
+ expect(active()).toBe('documents');
+ });
+
+ it('resets the stack to one view in one history entry, keeping a pane that already shows it', () => {
+ const { history, manager, shown, active } = setup('/home');
+ manager.openWithSplit(settings);
+ const entries = history.entries().length;
+
+ manager.replaceAllSplits(documents);
+ expect(shown()).toEqual(['documents']);
+ expect(active()).toBe('documents');
+ expect(history.entries()).toHaveLength(entries + 1);
+
+ manager.openWithSplit(home);
+ manager.openWithSplit(settings);
+ expect(shown()).toEqual(['documents', 'home', 'settings']);
+ const homePane = manager.splits()[1]!.id;
+
+ manager.replaceAllSplits(home);
+ expect(shown()).toEqual(['home']);
+ expect(manager.splits()[0]!.id).toBe(homePane);
+ expect(active()).toBe('home');
+ });
+
+ it('moves the pane holding a claim to the front when a router open lands on it', () => {
+ const { router, manager, shown, active } = setup('/home');
+ manager.openWithSplit(settings);
+ manager.openWithSplit(documents);
+
+ router.open('/settings', { newPane: true });
+ expect(shown()).toEqual(['home', 'documents', 'settings']);
+ expect(active()).toBe('settings');
+ });
+});
diff --git a/apps/web/src/features/next-soup/search-navigation-readers.test.tsx b/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
index 2264b554f2..e532dd76c4 100644
--- a/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
+++ b/apps/web/src/features/next-soup/search-navigation-readers.test.tsx
@@ -75,7 +75,7 @@ function setup(location: SearchLocation) {
setDocument,
router,
replay: () =>
- router.navigate(
+ router.navigatePane(
router.panes()[0]!,
{ route },
{
diff --git a/apps/web/src/lib/core/constant/SettingsState.test.tsx b/apps/web/src/lib/core/constant/SettingsState.test.tsx
index dedbbe9105..5a379cb278 100644
--- a/apps/web/src/lib/core/constant/SettingsState.test.tsx
+++ b/apps/web/src/lib/core/constant/SettingsState.test.tsx
@@ -131,14 +131,14 @@ describe('settings entry points', () => {
router.entry(pane)?.location.route.matches[0]?.params.tab;
const navigateTab = (tab: string) => {
expect(mocks.updateCurrentEntry).not.toHaveBeenCalled();
- router.navigate(pane, `/settings/${tab.toLowerCase()}`);
+ router.navigatePane(pane, `/settings/${tab.toLowerCase()}`);
};
state.selectTab('Appearance', navigateTab);
state.selectTab('Account', navigateTab);
expect(router.history(pane)?.entries).toHaveLength(3);
- router.navigate(pane, -1);
+ router.navigatePane(pane, -1);
expect(currentTab()).toBe('appearance');
- router.navigate(pane, -1);
+ router.navigatePane(pane, -1);
expect(currentTab()).toBe('account');
router.dispose();
});
diff --git a/apps/web/src/lib/core/constant/SettingsState.tsx b/apps/web/src/lib/core/constant/SettingsState.tsx
index b9c032328e..1e32341a7a 100644
--- a/apps/web/src/lib/core/constant/SettingsState.tsx
+++ b/apps/web/src/lib/core/constant/SettingsState.tsx
@@ -64,9 +64,8 @@ export const currentSettingsReturnTo = settingsReturnTo;
* Whether settings is the only visible split — the "clobbered" mode that
* looks and behaves like the old fullscreen route (app sidebar hidden,
* settings owns its own back/move-to-split affordances). Mobile is excluded:
- * its swipe layout always reports a visible count of 1 for the active split
- * (the backgrounded split is excluded from that count), which would
- * otherwise misidentify every mobile settings-open as "solo".
+ * its stacked panes always show exactly one, which would otherwise
+ * misidentify every mobile settings-open as "solo".
*/
export const isSoloSettings = () => {
if (isMobile()) return false;
@@ -76,8 +75,7 @@ export const isSoloSettings = () => {
if (!splitManager) return false;
// Derive the sole split from the visible set (not `splits()[0]`) so the
- // count check and the identity check agree even if an exclusion filter ever
- // hides a split ahead of settings.
+ // count check and the identity check agree.
const visible = splitManager.getVisibleSplits();
if (visible.length !== 1) return false;
diff --git a/apps/web/src/lib/split-router/next/panes/diff.ts b/apps/web/src/lib/split-router/next/panes/diff.ts
index d2b400fe4e..405513d037 100644
--- a/apps/web/src/lib/split-router/next/panes/diff.ts
+++ b/apps/web/src/lib/split-router/next/panes/diff.ts
@@ -57,6 +57,15 @@ export function diffPanes<E extends PaneEntry>(
return options.same(currentEntry(snapshot), entry);
};
+ // Incoming panes without a live id claim a pane already showing their entry before any slot.
+ const showing = incoming.map(({ paneId, entry }) => {
+ if (paneId && isLive(paneId)) return;
+
+ return live.panes.find((pane) => showsSame(pane, entry));
+ });
+ const reservedElsewhere = (pane: PaneId, position: number) =>
+ showing.some((match, index) => match === pane && index !== position);
+
const matchPane = (
{ paneId, entry }: IncomingPane<E>,
position: number
@@ -64,8 +73,14 @@ export function diffPanes<E extends PaneEntry>(
const liveAndFree = paneId && isLive(paneId) && !isUsed(paneId);
if (liveAndFree) return paneId;
+ const shown = showing[position];
+ if (shown && !isUsed(shown)) return shown;
+
const positional = live.panes[position];
- const slotTaken = positional === undefined || isUsed(positional);
+ const slotTaken =
+ positional === undefined ||
+ isUsed(positional) ||
+ reservedElsewhere(positional, position);
if (slotTaken) return;
if (!paneId) return positional;
if (isLive(paneId)) return;
diff --git a/apps/web/src/lib/split-router/next/router/create-router.ts b/apps/web/src/lib/split-router/next/router/create-router.ts
index a34d842872..248e46a4e5 100644
--- a/apps/web/src/lib/split-router/next/router/create-router.ts
+++ b/apps/web/src/lib/split-router/next/router/create-router.ts
@@ -76,7 +76,7 @@ export function createSplitRouter(options: SplitRouterOptions) {
url,
runner,
claims,
- showAlone: urlNavigation.showAlone,
+ navigateToLocation: urlNavigation.navigateToLocation,
});
const paneList = createPaneList({
@@ -126,7 +126,8 @@ export function createSplitRouter(options: SplitRouterOptions) {
claims: claims.registry,
ready,
panes: panes.ids,
- navigate: paneNavigation.navigate,
+ navigate: urlNavigation.navigate,
+ navigatePane: paneNavigation.navigate,
updateSearch: paneNavigation.updateSearch,
goBackTo: paneNavigation.goBackTo,
removeEntries: paneNavigation.removeEntries,
diff --git a/apps/web/src/lib/split-router/next/router/pane-list.ts b/apps/web/src/lib/split-router/next/router/pane-list.ts
index 3ac137ecf9..3926e59e9e 100644
--- a/apps/web/src/lib/split-router/next/router/pane-list.ts
+++ b/apps/web/src/lib/split-router/next/router/pane-list.ts
@@ -221,7 +221,7 @@ export function createPaneList(options: {
const intoPane = 'pane' in target ? target.pane : undefined;
if (navigation.leavesSharedRoute(intoPane, location)) {
- return navigation.showAlone(location, navigateOptions);
+ return navigation.navigateToLocation(location, navigateOptions);
}
const { placement, holder } = placementFor(
diff --git a/apps/web/src/lib/split-router/next/router/pane-navigation.ts b/apps/web/src/lib/split-router/next/router/pane-navigation.ts
index 6ddd10363d..6d17db529b 100644
--- a/apps/web/src/lib/split-router/next/router/pane-navigation.ts
+++ b/apps/web/src/lib/split-router/next/router/pane-navigation.ts
@@ -155,7 +155,7 @@ export function createPaneNavigation(options: {
runner: Runner;
claims: Claims;
/** Shows `location` as the only pane, for a destination the other panes can't share the URL with. */
- showAlone(
+ navigateToLocation(
location: SplitLocation,
navigateOptions: SplitNavigateOptions
): MaybePromise<NavigationResult>;
@@ -297,7 +297,7 @@ export function createPaneNavigation(options: {
if (!location) return CANCELLED_RESULT;
if (leavesSharedRoute(pane, location)) {
- return options.showAlone(location, navigateOptions);
+ return options.navigateToLocation(location, navigateOptions);
}
return visitLocation(pane, from, location, navigateOptions);
@@ -502,6 +502,6 @@ export function createPaneNavigation(options: {
backStep,
jumpBack,
leavesSharedRoute,
- showAlone: options.showAlone,
+ navigateToLocation: options.navigateToLocation,
};
}
diff --git a/apps/web/src/lib/split-router/next/router/url-navigation.ts b/apps/web/src/lib/split-router/next/router/url-navigation.ts
index 78751d255b..85bc6ebf03 100644
--- a/apps/web/src/lib/split-router/next/router/url-navigation.ts
+++ b/apps/web/src/lib/split-router/next/router/url-navigation.ts
@@ -5,12 +5,18 @@ import type {
InterceptHandler,
} from '../history/types';
import { type ChangedPane, changedPanes } from '../panes/diff';
-import { decodePanes, sameExternalLocation } from '../routes/codec';
+import {
+ decodePanes,
+ parseLocation,
+ sameExternalLocation,
+} from '../routes/codec';
import type { SplitRoutesManifest } from '../routes/manifest';
+import { resolveTarget } from '../routes/targets';
import type {
Entry,
ExternalLocation,
SplitLocation,
+ SplitNavigationTarget,
WriteMode,
} from '../routes/types';
import { type MaybePromise, UNCANCELLABLE } from '../utils';
@@ -22,13 +28,14 @@ import {
runChecks,
} from './leave-guards';
import type { Runner } from './runner';
-import type {
- Navigation,
- NavigationCause,
- NavigationResult,
- PaneTarget,
- RouterPanes,
- SplitNavigateOptions,
+import {
+ CANCELLED_RESULT,
+ type Navigation,
+ type NavigationCause,
+ type NavigationResult,
+ type PaneTarget,
+ type RouterPanes,
+ type SplitNavigateOptions,
} from './types';
import type { Url } from './url';
@@ -95,11 +102,8 @@ export function createUrlNavigation(options: {
};
};
- /**
- * Shows `location` as the only pane: a pane navigating under a different
- * top-level route can't share the URL with the others.
- */
- const showAlone = (
+ /** A navigation from the base to one location, which becomes the only pane. */
+ const navigateToLocation = (
location: SplitLocation,
navigateOptions: SplitNavigateOptions
): MaybePromise<NavigationResult> => {
@@ -112,7 +116,7 @@ export function createUrlNavigation(options: {
removed: diff.removed,
apply: (entries) => {
panes.applyDiff(diff, entries);
- url.write('push');
+ url.write(navigateOptions.replace ? 'replace' : 'push');
const [first] = diff.panes;
@@ -123,6 +127,31 @@ export function createUrlNavigation(options: {
return runner.startUrl(navigation, false);
};
+ /**
+ * A navigation from the base, as any router's: a path's panes replace the
+ * open ones, and a route or location target becomes the only pane. Panes
+ * already showing their entry stay mounted.
+ */
+ const navigate = (
+ to: SplitNavigationTarget,
+ navigateOptions: SplitNavigateOptions = {}
+ ): MaybePromise<NavigationResult> => {
+ if (typeof to === 'string') {
+ const mode = navigateOptions.replace ? 'replace' : 'push';
+ const navigation = navigationTo(parseLocation(to), {
+ cause: 'navigate',
+ mode,
+ });
+
+ return runner.startUrl(navigation, false);
+ }
+
+ const location = resolveTarget(routes, undefined, to, navigateOptions);
+ if (!location) return CANCELLED_RESULT;
+
+ return navigateToLocation(location, navigateOptions);
+ };
+
/** The first load; pane actions wait for it. */
const load = (location: ExternalLocation) => {
const navigation = navigationTo(location, {
@@ -196,7 +225,8 @@ export function createUrlNavigation(options: {
};
return {
- showAlone,
+ navigate,
+ navigateToLocation,
/** Loads the URL and follows the history adapter until the returned stop is called. */
connect(): () => void {
diff --git a/apps/web/src/lib/split-router/next/solid/hooks.ts b/apps/web/src/lib/split-router/next/solid/hooks.ts
index c9ab2aed58..0873dc93c0 100644
--- a/apps/web/src/lib/split-router/next/solid/hooks.ts
+++ b/apps/web/src/lib/split-router/next/solid/hooks.ts
@@ -2,10 +2,11 @@ import deepEqual from 'fast-deep-equal';
import { type Accessor, createMemo, untrack, useContext } from 'solid-js';
import type { PaneSnapshot } from '../panes/types';
import type { PendingNavigation } from '../router/runner';
-import type {
- NavigationResult,
- RouteMatchInfo,
- SplitNavigateOptions,
+import {
+ CANCELLED_RESULT,
+ type NavigationResult,
+ type RouteMatchInfo,
+ type SplitNavigateOptions,
} from '../router/types';
import {
getRouteEntryState,
@@ -132,15 +133,23 @@ export function useEntryProps<T = unknown>(): T | undefined {
}
/** Navigates this pane. Relative paths resolve against the calling route. */
+/** Navigates the enclosing pane; outside any pane, it navigates from the base. */
export function useNavigate(): SplitNavigate {
const router = useSplitRouter();
- const scope = usePaneContext();
+ const scope = useContext(PaneContext);
const navigate = (
to: SplitNavigationTarget | number,
options: SplitNavigateOptions & NewPaneOption = {}
) => {
const { newPane, ...rest } = options;
+
+ if (!scope) {
+ if (typeof to === 'number') return CANCELLED_RESULT;
+
+ return router.navigate(to, rest);
+ }
+
const navigateOptions = { ...rest, depth: scope.depth() };
if (newPane && typeof to !== 'number') {
@@ -149,7 +158,7 @@ export function useNavigate(): SplitNavigate {
return router.open(to, target, navigateOptions);
}
- return router.navigate(scope.pane(), to, navigateOptions);
+ return router.navigatePane(scope.pane(), to, navigateOptions);
};
return navigate as SplitNavigate;
diff --git a/apps/web/src/lib/split-router/next/tests/router.test.ts b/apps/web/src/lib/split-router/next/tests/router.test.ts
index 3b859fcadd..9c9e93e130 100644
--- a/apps/web/src/lib/split-router/next/tests/router.test.ts
+++ b/apps/web/src/lib/split-router/next/tests/router.test.ts
@@ -163,7 +163,7 @@ describe('split router', () => {
const { router, history, pane } = track(setup('/home/~/drive'));
const drive = router.entry(pane(1));
- const result = router.navigate(pane(0), '/mail/t1');
+ const result = router.navigatePane(pane(0), '/mail/t1');
expect(result).toEqual({ status: 'committed', pane: pane(0) });
expect(router.entry(pane(1))).toBe(drive);
expect(router.arrival(pane(1))).toBe('fresh');
@@ -183,7 +183,7 @@ describe('split router', () => {
it('turns a pane navigation outside the shared top-level route into a whole-window one, and Back rebuilds the panes', () => {
const { router, history, pane } = track(setup('/home/~/mail'));
- router.navigate(pane(1), '/login');
+ router.navigatePane(pane(1), '/login');
expect(
router.panes().map((id) => router.entry(id)?.location.route.matches)
).toEqual([[{ id: 'login', params: {} }]]);
@@ -201,21 +201,21 @@ describe('split router', () => {
it('skips entries under another top-level route on pane Back while other panes share the app route', () => {
const { router, pane } = track(setup('/home'));
- router.navigate(pane(0), '/login');
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/login');
+ router.navigatePane(pane(0), '/mail');
router.open('/drive', { newPane: true, source: pane(0) });
expect(router.panes()).toHaveLength(2);
expect(router.canGo(pane(0), -1)).toBe(true);
- router.navigate(pane(0), -1);
+ router.navigatePane(pane(0), -1);
expect(routeIds(router.entry(pane(0)))).toEqual(['home']);
expect(router.canGo(pane(0), -1)).toBe(false);
});
it('pane back replaces the browser entry and records how the pane arrived', () => {
const { router, history, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), -1);
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), -1);
expect(routeIds(router.entry(pane(0)))).toEqual(['home']);
expect(router.arrival(pane(0))).toBe('back');
expect(router.canGo(pane(0), 1)).toBe(true);
@@ -227,7 +227,7 @@ describe('split router', () => {
it('browser back brings a pane back through its own history', () => {
const { router, history, paneStore, pane } = track(setup('/home/~/drive'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
const drive = router.entry(pane(1));
history.back();
expect(routeIds(router.entry(pane(0)))).toEqual(['home']);
@@ -239,7 +239,7 @@ describe('split router', () => {
it('a leave guard can refuse browser back, and the URL is put back', () => {
const { router, history, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, () => false);
history.back();
expect(routeIds(router.entry(pane(0)))).toEqual(['mail']);
@@ -252,7 +252,7 @@ describe('split router', () => {
const { router, solid } = track(setupSolid('/app/home'));
vi.runAllTimers();
const pane = router.panes()[0]!;
- router.navigate(pane, '/mail');
+ router.navigatePane(pane, '/mail');
vi.runAllTimers();
const mail = router.entry(pane);
router.registerGuard(pane, PANE_ROUTE_LEVEL, () => false);
@@ -276,7 +276,7 @@ describe('split router', () => {
allow = resolve;
})
);
- const result = router.navigate(pane(0), '/mail');
+ const result = router.navigatePane(pane(0), '/mail');
expect(isPromise(result)).toBe(true);
expect(routeIds(router.pending(pane(0))?.to)).toEqual(['mail']);
expect(routeIds(router.entry(pane(0)))).toEqual(['home']);
@@ -300,8 +300,8 @@ describe('split router', () => {
expect(router.ready()).toBe(false);
await router.settled();
expect(router.ready()).toBe(true);
- const first = router.navigate(pane(0), '/mail');
- const second = router.navigate(pane(0), '/drive');
+ const first = router.navigatePane(pane(0), '/mail');
+ const second = router.navigatePane(pane(0), '/drive');
await expect(first).resolves.toEqual({ status: 'cancelled' });
await expect(second).resolves.toMatchObject({ status: 'committed' });
expect(routeIds(router.entry(pane(0)))).toEqual(['drive']);
@@ -310,9 +310,9 @@ describe('split router', () => {
it('a superseded navigation settles even when its guard never does', async () => {
const { router, pane } = track(setup('/home'));
const unregister = router.registerGuard(pane(0), PANE_ROUTE_LEVEL, never);
- const first = router.navigate(pane(0), '/mail');
+ const first = router.navigatePane(pane(0), '/mail');
unregister();
- const second = router.navigate(pane(0), '/drive');
+ const second = router.navigatePane(pane(0), '/drive');
await expect(first).resolves.toEqual({ status: 'cancelled' });
expect(second).toMatchObject({ status: 'committed' });
});
@@ -325,8 +325,8 @@ describe('split router', () => {
PANE_ROUTE_LEVEL,
() => new Promise<boolean>((resolve) => answers.push(resolve))
);
- const first = router.navigate(pane(0), '/mail');
- const second = router.navigate(pane(0), '/drive');
+ const first = router.navigatePane(pane(0), '/mail');
+ const second = router.navigatePane(pane(0), '/drive');
answers[0]!(true);
answers[1]!(false);
await expect(first).resolves.toEqual({ status: 'cancelled' });
@@ -336,7 +336,7 @@ describe('split router', () => {
it('browser back cancels a pane navigation still in flight', async () => {
const { router, history, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
let allow: (allowed: boolean) => void = () => {};
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ cause }) =>
cause === 'external'
@@ -345,7 +345,7 @@ describe('split router', () => {
allow = resolve;
})
);
- const drive = router.navigate(pane(0), '/drive');
+ const drive = router.navigatePane(pane(0), '/drive');
history.back();
allow(true);
await expect(drive).resolves.toEqual({ status: 'cancelled' });
@@ -388,7 +388,7 @@ describe('split router', () => {
const { router, solid } = track(setupSolid('/app/home'));
vi.runAllTimers();
const pane = router.panes()[0]!;
- router.navigate(pane, '/mail');
+ router.navigatePane(pane, '/mail');
vi.runAllTimers();
router.registerGuard(pane, PANE_ROUTE_LEVEL, never);
solid.traverse(-1);
@@ -403,7 +403,7 @@ describe('split router', () => {
it('a pane command cancels a pending browser back and reverts it first', () => {
const { router, history, pane } = track(setup('/home/~/drive'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
let guardSignal: AbortSignal | undefined;
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ signal }) => {
guardSignal = signal;
@@ -412,7 +412,7 @@ describe('split router', () => {
history.back();
expect(routeIds(router.pending(pane(0))?.to)).toEqual(['home']);
- expect(router.navigate(pane(1), '/drive/folder/f1')).toMatchObject({
+ expect(router.navigatePane(pane(1), '/drive/folder/f1')).toMatchObject({
status: 'committed',
});
expect(guardSignal?.aborted).toBe(true);
@@ -431,7 +431,7 @@ describe('split router', () => {
const { router, solid } = track(setupSolid('/app/home'));
vi.runAllTimers();
const pane = router.panes()[0]!;
- router.navigate(pane, '/mail');
+ router.navigatePane(pane, '/mail');
vi.runAllTimers();
router.registerGuard(pane, PANE_ROUTE_LEVEL, ({ cause }) =>
cause === 'external' ? never() : true
@@ -439,7 +439,7 @@ describe('split router', () => {
solid.traverse(-1);
expect(routeIds(router.pending(pane)?.to)).toEqual(['home']);
- const result = router.navigate(pane, '/drive');
+ const result = router.navigatePane(pane, '/drive');
expect(isPromise(result)).toBe(true);
await expect(result).resolves.toMatchObject({ status: 'committed' });
vi.runAllTimers();
@@ -468,7 +468,7 @@ describe('split router', () => {
],
})
);
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
slow = true;
history.back();
expect(routeIds(router.pending(pane(0))?.to)).toEqual(['home']);
@@ -479,12 +479,12 @@ describe('split router', () => {
it('opening something another pane shows activates that pane instead', () => {
const { router, activated, pane } = track(setup('/drive/md/d1/~/home'));
- const result = router.navigate(pane(1), '/md/d1');
+ const result = router.navigatePane(pane(1), '/md/d1');
expect(result).toEqual({ status: 'activated', owner: pane(0) });
expect(activated).toEqual([pane(0)]);
expect(routeIds(router.entry(pane(1)))).toEqual(['home']);
expect(
- router.navigate(pane(1), '/md/d1', { allowDuplicate: true })
+ router.navigatePane(pane(1), '/md/d1', { allowDuplicate: true })
).toMatchObject({ status: 'committed' });
});
@@ -527,7 +527,7 @@ describe('split router', () => {
);
const opened = router.open('/md/d1', { newPane: true, source: pane(1) });
- router.navigate(pane(0), '/md/d1');
+ router.navigatePane(pane(0), '/md/d1');
release();
await expect(opened).resolves.toEqual({
@@ -539,15 +539,15 @@ describe('split router', () => {
it('skips entries another pane shows on Back and Forward, unless duplicates are allowed', () => {
const { router, pane } = track(setup('/home/~/home'));
- router.navigate(pane(0), '/md/d1');
- router.navigate(pane(0), '/drive');
- router.navigate(pane(1), '/md/d1');
+ router.navigatePane(pane(0), '/md/d1');
+ router.navigatePane(pane(0), '/drive');
+ router.navigatePane(pane(1), '/md/d1');
- router.navigate(pane(0), -1);
+ router.navigatePane(pane(0), -1);
expect(routeIds(router.entry(pane(0)))).toEqual(['home']);
expect(router.canGo(pane(0), 1)).toBe(true);
- router.navigate(pane(0), 1, { allowDuplicate: true });
+ router.navigatePane(pane(0), 1, { allowDuplicate: true });
expect(routeIds(router.entry(pane(0)))).toEqual(['block']);
});
@@ -568,8 +568,8 @@ describe('split router', () => {
it('browser back brings back a duplicate', () => {
const { router, history, activated, pane } = track(setup('/home/~/md/d1'));
- router.navigate(pane(0), '/md/d1', { allowDuplicate: true });
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/md/d1', { allowDuplicate: true });
+ router.navigatePane(pane(0), '/drive');
history.back();
expect(routeIds(router.entry(pane(0)))).toEqual(['block']);
expect(activated).toEqual([]);
@@ -596,7 +596,7 @@ describe('split router', () => {
expect(history.read().path).toBe('/home');
expect(router.close('pane-1' as PaneId)).toBe(false);
- router.navigate('pane-1' as PaneId, '/mail');
+ router.navigatePane('pane-1' as PaneId, '/mail');
expect(router.close('pane-1' as PaneId)).toBe(true);
expect(router.panes()).toEqual(['pane-1']);
expect(history.read().path).toBe('/home');
@@ -664,6 +664,44 @@ describe('split router', () => {
expect(guard).not.toHaveBeenCalled();
});
+ it('navigates from the base, keeping the pane that already shows the destination', () => {
+ const { router, history } = track(setup('/home/~/mail/~/drive'));
+ const [home, mail, drive] = router.panes();
+ const mailEntry = router.entry(mail!);
+ let allowDrive = false;
+ router.registerGuard(drive!, PANE_LEVEL, () => allowDrive);
+
+ expect(router.navigate('/mail')).toMatchObject({ status: 'cancelled' });
+ expect(router.panes()).toEqual([home, mail, drive]);
+
+ allowDrive = true;
+ expect(router.navigate('/mail')).toMatchObject({ status: 'committed' });
+ expect(router.panes()).toEqual([mail]);
+ expect(router.entry(mail!)).toBe(mailEntry);
+ expect(history.entries().map((entry) => entry.path)).toEqual([
+ '/home/~/mail/~/drive',
+ '/mail',
+ ]);
+ });
+
+ it('keeps panes that already show their entry when a base navigation reorders them', () => {
+ const { router, history } = track(setup('/home/~/mail'));
+ const [home] = router.panes();
+
+ router.navigate('/drive/~/home');
+ expect(router.panes().map((id) => routeIds(router.entry(id)))).toEqual([
+ ['drive'],
+ ['home'],
+ ]);
+ expect(router.panes()[1]).toBe(home);
+ expect(history.read().path).toBe('/drive/~/home');
+
+ router.navigate({ location: location('mail') });
+ expect(router.panes().map((id) => routeIds(router.entry(id)))).toEqual([
+ ['mail'],
+ ]);
+ });
+
it('closing the last pane can go back to an earlier entry', () => {
const closeLast: SplitCloseAction = {
type: 'back-to',
@@ -673,7 +711,7 @@ describe('split router', () => {
const { router, pane } = track(
setup('/mail', {}, createTestPolicy({ closeLast }))
);
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/drive');
expect(router.close(pane(0))).toBe(true);
expect(routeIds(router.entry(pane(0)))).toEqual(['mail']);
expect(router.canGo(pane(0), 1)).toBe(true);
@@ -747,9 +785,9 @@ describe('split router', () => {
const { router, pane } = track(
setup('/home', { routes, preloadBudgetMs: 5 })
);
- expect(isPromise(router.navigate(pane(0), '/mail'))).toBe(false);
+ expect(isPromise(router.navigatePane(pane(0), '/mail'))).toBe(false);
- const result = router.navigate(pane(0), '/slow');
+ const result = router.navigatePane(pane(0), '/slow');
expect(isPromise(result)).toBe(true);
expect(preload).toHaveBeenCalledWith(
expect.objectContaining({ intent: 'navigate', params: {} })
@@ -770,7 +808,7 @@ describe('split router', () => {
})
);
const { router, pane } = track(setup('/home', { routes }));
- expect(router.navigate(pane(0), '/broken')).toEqual({
+ expect(router.navigatePane(pane(0), '/broken')).toEqual({
status: 'committed',
pane: pane(0),
});
@@ -800,8 +838,8 @@ describe('split router', () => {
it('jumps back to the nearest matching entry', () => {
const { router, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), '/drive');
expect(
router.goBackTo(pane(0), (entry) => routeIds(entry)?.[0] === 'home')
).toBe(true);
@@ -811,10 +849,10 @@ describe('split router', () => {
it('removing entries cancels a pending traversal in that pane', async () => {
const { router, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), '/drive');
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, never);
- const back = router.navigate(pane(0), -1);
+ const back = router.navigatePane(pane(0), -1);
expect(routeIds(router.pending(pane(0))?.to)).toEqual(['mail']);
const isMail = (entry: Entry) => routeIds(entry)?.[0] === 'mail';
@@ -849,7 +887,7 @@ describe('split router while other work is in flight', () => {
const showsDrive = routeIds(router.entry(pane(0)))?.[0] === 'drive';
if (!showsDrive) return;
- untrack(() => router.navigate(pane(0), '/mail', { replace: true }));
+ untrack(() => router.navigatePane(pane(0), '/mail', { replace: true }));
});
return dispose;
@@ -905,8 +943,8 @@ describe('split router while other work is in flight', () => {
it('puts the URL back past every Back that a refused Back replaced', async () => {
const { router, history, pane } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), '/drive');
const answers: ((allowed: boolean) => void)[] = [];
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ cause }) => {
if (cause !== 'external') return true;
@@ -936,8 +974,8 @@ describe('split router while other work is in flight', () => {
})
);
- const departure = router.navigate(pane(0), '/drive');
- expect(router.navigate(pane(1), '/md/d1')).toEqual({
+ const departure = router.navigatePane(pane(0), '/drive');
+ expect(router.navigatePane(pane(1), '/md/d1')).toEqual({
status: 'activated',
owner: pane(0),
});
@@ -952,7 +990,7 @@ describe('split router while other work is in flight', () => {
const { router, activated, pane } = track(setup('/drive/md/d1/~/home'));
expect(
- router.navigate(pane(1), '/drive/md/d1', {
+ router.navigatePane(pane(1), '/drive/md/d1', {
search: { drive: { sort: ['name'] } },
})
).toEqual({ status: 'activated', owner: pane(0) });
@@ -983,7 +1021,7 @@ describe('split router while other work is in flight', () => {
await router.settled();
const sorting = router.updateSearch(pane(0), 'drive', { sort: ['date'] });
- router.navigate(pane(1), '/drive/md/d1');
+ router.navigatePane(pane(1), '/drive/md/d1');
release();
await expect(sorting).resolves.toMatchObject({ status: 'committed' });
@@ -1029,7 +1067,7 @@ describe('split router while other work is in flight', () => {
expect(routeIds(router.entry(pane(0)))).toEqual(['drive']);
expect(router.entry(pane(0))?.location.search).toBeUndefined();
- expect(router.navigate(pane(0), '/mail')).toMatchObject({
+ expect(router.navigatePane(pane(0), '/mail')).toMatchObject({
status: 'committed',
});
expect(history.read().path).toBe('/mail');
@@ -1061,7 +1099,7 @@ describe('split router while other work is in flight', () => {
const { router, pane } = track(
setup('/home', {}, createTestPolicy({ closeLast }))
);
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/drive');
router.registerGuard(
pane(0),
PANE_ROUTE_LEVEL,
@@ -1100,13 +1138,13 @@ describe('split router while other work is in flight', () => {
const showsDrive = routeIds(router.entry(pane(0)))?.[0] === 'drive';
if (!showsDrive) return;
- untrack(() => router.navigate(pane(1), '/mail', { replace: true }));
+ untrack(() => router.navigatePane(pane(1), '/mail', { replace: true }));
});
return dispose;
});
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/drive');
await router.settled();
stopRedirecting();
@@ -1118,7 +1156,7 @@ describe('split router while other work is in flight', () => {
it('keeps a Back whose view redirects in place as it mounts', async () => {
const { router, history, pane } = track(setup('/drive'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
let armed = false;
const stopRedirecting = createRoot((dispose) => {
createEffect(() => {
@@ -1126,7 +1164,7 @@ describe('split router while other work is in flight', () => {
const redirects = armed && showsDrive;
if (!redirects) return;
- untrack(() => router.navigate(pane(0), '/home', { replace: true }));
+ untrack(() => router.navigatePane(pane(0), '/home', { replace: true }));
});
return dispose;
@@ -1163,8 +1201,10 @@ describe('split router while other work is in flight', () => {
const { router, pane } = track(setup('/home', { history: flaky }));
failNext = true;
- expect(router.navigate(pane(0), '/mail')).toEqual({ status: 'cancelled' });
- expect(router.navigate(pane(0), '/drive')).toMatchObject({
+ expect(router.navigatePane(pane(0), '/mail')).toEqual({
+ status: 'cancelled',
+ });
+ expect(router.navigatePane(pane(0), '/drive')).toMatchObject({
status: 'committed',
});
expect(history.read().path).toBe('/drive');
@@ -1177,14 +1217,14 @@ describe('split router while other work is in flight', () => {
it('settles a URL navigation that arrives while an earlier one is being put back', async () => {
const { history, adapter, landAll } = slowRevertHistory('/home');
const { router, pane } = track(setup('/home', { history: adapter }));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), '/drive');
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ cause }) =>
cause === 'external' ? never() : true
);
history.back();
- const navigated = router.navigate(pane(0), '/drive/folder/f1');
+ const navigated = router.navigatePane(pane(0), '/drive/folder/f1');
history.back();
await landAll();
@@ -1197,9 +1237,9 @@ describe('split router while other work is in flight', () => {
it('puts back a Back that arrives while others are put back before them', async () => {
const { history, adapter, landAll } = slowRevertHistory('/home');
const { router, pane } = track(setup('/home', { history: adapter }));
- router.navigate(pane(0), '/mail');
- router.navigate(pane(0), '/drive');
- router.navigate(pane(0), '/md/d1');
+ router.navigatePane(pane(0), '/mail');
+ router.navigatePane(pane(0), '/drive');
+ router.navigatePane(pane(0), '/md/d1');
let refuse: () => void = () => {};
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ cause }) => {
if (cause !== 'external') return true;
@@ -1234,7 +1274,7 @@ describe('split router while other work is in flight', () => {
it('checks again before running a waiting action that a new Back overtook', async () => {
const { router, history, pane, paneStore } = track(setup('/home'));
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
let allow: (allowed: boolean) => void = () => {};
router.registerGuard(pane(0), PANE_ROUTE_LEVEL, ({ cause }) => {
if (cause !== 'external') return true;
@@ -1252,14 +1292,14 @@ describe('split router while other work is in flight', () => {
redirected = true;
untrack(() =>
- router.navigate(pane(0), '/drive/folder/f1', { replace: true })
+ router.navigatePane(pane(0), '/drive/folder/f1', { replace: true })
);
});
return dispose;
});
- router.navigate(pane(0), '/drive');
+ router.navigatePane(pane(0), '/drive');
history.back();
await Promise.resolve();
await Promise.resolve();
@@ -1291,7 +1331,7 @@ describe('split router while other work is in flight', () => {
const { router, pane } = track(setup('/home', { history: flaky }));
failNext = true;
- router.navigate(pane(0), '/mail');
+ router.navigatePane(pane(0), '/mail');
router.rewriteCurrent(pane(0), '/mail');
expect(history.read().path).toBe('/mail');
@@ -1313,7 +1353,7 @@ describe('split router while other work is in flight', () => {
const { router, solid, dispose } = setupSolid('/app/home');
vi.runAllTimers();
- router.navigate(router.panes()[0]!, '/mail');
+ router.navigatePane(router.panes()[0]!, '/mail');
dispose();
vi.runAllTimers();
@@ -1341,7 +1381,7 @@ describe('split router while other work is in flight', () => {
const { router, solid } = track(setupSolid('/app/home'));
vi.runAllTimers();
- router.navigate(router.panes()[0]!, '/mail');
+ router.navigatePane(router.panes()[0]!, '/mail');
expect(solid.leave('/settings').defaultPrevented).toBe(false);
vi.runAllTimers();
@@ -1350,7 +1390,7 @@ describe('split router while other work is in flight', () => {
it('moves the cursor on Back to an entry that looks like the current one', () => {
const { router, history, paneStore, pane } = track(setup('/home'));
- router.navigate(pane(0), '/home', { props: { note: 1 } });
+ router.navigatePane(pane(0), '/home', { props: { note: 1 } });
expect(paneStore.read(pane(0))?.entries).toHaveLength(2);
history.back();
diff --git a/apps/web/src/lib/split-router/next/tests/solid.test.tsx b/apps/web/src/lib/split-router/next/tests/solid.test.tsx
index e7617db1ea..1cda67a5f0 100644
--- a/apps/web/src/lib/split-router/next/tests/solid.test.tsx
+++ b/apps/web/src/lib/split-router/next/tests/solid.test.tsx
@@ -254,12 +254,12 @@ describe('split router Solid bindings', () => {
const pane = router.panes()[0]!;
expect(screen.getByTestId('document').textContent).toBe('md:d1');
- router.navigate(pane, '/drive/md/d2');
+ router.navigatePane(pane, '/drive/md/d2');
expect(screen.getByTestId('document').textContent).toBe('md:d2');
expect(counts).toEqual({ drive: 1, document: 1 });
expect(documentTypeReads).toHaveBeenCalledTimes(1);
- router.navigate(pane, '/drive/pdf/d2');
+ router.navigatePane(pane, '/drive/pdf/d2');
expect(counts).toEqual({ drive: 1, document: 2 });
});
@@ -273,7 +273,7 @@ describe('split router Solid bindings', () => {
);
expect(screen.getByTestId('document').textContent).toBe('md:d1');
- router.navigate(pane, '/home');
+ router.navigatePane(pane, '/home');
expect(screen.getByTestId('header').textContent).toBe('app/home back:true');
expect(screen.getByText('home')).toBeTruthy();
});
@@ -288,7 +288,7 @@ describe('split router Solid bindings', () => {
const second = router.panes()[1]!;
allowLeave = false;
- expect(router.navigate(second, '/home')).toMatchObject({
+ expect(router.navigatePane(second, '/home')).toMatchObject({
status: 'committed',
});
expect(await router.close(second)).toBe(false);
@@ -332,14 +332,14 @@ describe('split router Solid bindings', () => {
allowLeave = false;
const second = router.panes()[1]!;
- expect(router.navigate(second, '/home')).toMatchObject({
+ expect(router.navigatePane(second, '/home')).toMatchObject({
status: 'committed',
});
expect(screen.getAllByText('home')).toHaveLength(2);
expect(await router.close(second)).toBe(false);
allowLeave = true;
- await router.navigate(router.panes()[0]!, '/login');
+ await router.navigatePane(router.panes()[0]!, '/login');
expect(screen.getByText('login')).toBeTruthy();
expect(screen.queryAllByTestId('pane')).toHaveLength(0);
expect(history.read().path).toBe('/login');
@@ -373,12 +373,12 @@ describe('split router Solid bindings', () => {
const { router, history } = renderPanes('/guarded');
const pane = router.panes()[0]!;
allowLeave = false;
- router.navigate(pane, '/home');
+ router.navigatePane(pane, '/home');
expect(screen.getByTestId('guarded')).toBeTruthy();
router.updateSearch(pane, 'anything', { x: ['1'] });
expect(history.read().search).toBe('?s0.anything.x=1');
allowLeave = true;
- router.navigate(pane, '/home');
+ router.navigatePane(pane, '/home');
expect(screen.queryByTestId('guarded')).toBeNull();
});
@@ -443,7 +443,7 @@ describe('<SplitRouter.Router>', () => {
expect(screen.getByText('inbox')).toBeTruthy();
expect(home).not.toHaveProperty('component');
- await router!.navigate(router!.panes()[0]!, '/login');
+ await router!.navigatePane(router!.panes()[0]!, '/login');
expect(screen.getByText('login')).toBeTruthy();
expect(screen.queryAllByTestId('pane')).toHaveLength(0);
expect(history.read().path).toBe('/login');
diff --git a/apps/web/src/routes/app-router-view.tsx b/apps/web/src/routes/app-router-view.tsx
index 84a8df92e1..7bbe822940 100644
--- a/apps/web/src/routes/app-router-view.tsx
+++ b/apps/web/src/routes/app-router-view.tsx
@@ -184,7 +184,7 @@ export function AppRouterView() {
defaultLocation: () => ({
route: paneRoute({ id: 'view-home', params: {} }),
}),
- singlePane: isNativeMobilePlatform,
+ stacked: isNativeMobilePlatform,
})}
middleware={createAppSplitRouterMiddleware({ isTouchDevice })}
globalSearch={['referral_code']}