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.

refactor(web): remove Preview Pair split model (#6697)

Peter Chinman4936ab4cd132
diff --git a/apps/web/src/components/app/split-layout/SplitLayout.tsx b/apps/web/src/components/app/split-layout/SplitLayout.tsx
index 65e24f9bff..4e6421c511 100644
--- a/apps/web/src/components/app/split-layout/SplitLayout.tsx
+++ b/apps/web/src/components/app/split-layout/SplitLayout.tsx
@@ -3,7 +3,6 @@ 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 { useWindowSize } from '@solid-primitives/resize-observer';
import { useLocation, useNavigate } from '@solidjs/router';
import {
createEffect,
@@ -23,17 +22,14 @@ import {
type SplitId,
type SplitManager,
} from './layoutManager';
-import { createLayoutUrlSync, restorePreviewPairs } from './layoutUrlSync';
+import { createLayoutUrlSync } from './layoutUrlSync';
+import { decodePairs } from './layoutUtils';
import {
createMobileSwipeLayout,
type MobileSwipeLayout,
} from './mobile/createMobileSwipeLayout';
import { MobileSplitContainer } from './mobile/MobileSplitContainer';
-import {
- loadRestorablePreviewLayout,
- PREVIEW_QUERY_PARAM,
-} from './previewPersistence';
-import { splitMinWidthForContent } from './splitContentSizing';
+import { DEFAULT_SPLIT_MIN_WIDTH } from './splitContentSizing';
import { createSplitFocusTracker } from './splitFocusTracker';
type SplitLayoutContainerProps = {
@@ -44,20 +40,9 @@ type SplitLayoutContainerProps = {
export function SplitLayoutContainer(props: SplitLayoutContainerProps) {
const location = useLocation();
const navigate = useNavigate();
- const viewportSize = useWindowSize();
- const previewQuery = () => location.query[PREVIEW_QUERY_PARAM];
- const decodedLayout = createMemo(() =>
- loadRestorablePreviewLayout(props.pairs, previewQuery(), {
- allowPreviewPairs: !isTouchDevice(),
- })
- );
- const initialLayout = decodedLayout();
+ const initialContents = decodePairs(props.pairs);
const blockOrchestrator = useGlobalBlockOrchestrator();
- const splitManager = createSplitLayout(
- blockOrchestrator,
- initialLayout.contents
- );
- restorePreviewPairs(splitManager, initialLayout.previewPairs);
+ const splitManager = createSplitLayout(blockOrchestrator, initialContents);
const [, setTabTitle] = tabTitleSignal;
// Create the mobile swipe layout once on mobile devices.
@@ -74,7 +59,7 @@ export function SplitLayoutContainer(props: SplitLayoutContainerProps) {
// Drop refs for departed splits by reconciling against the live list:
// batched mutations can remove several splits in one flush (e.g. closing
- // a Preview Pair), and the events signal only surfaces the last event.
+ // multiple splits), and the events signal only surfaces the last event.
createEffect(() => {
const alive = new Set(splits().map(({ id }) => id));
for (const id of panelRefs.keys()) {
@@ -95,17 +80,10 @@ export function SplitLayoutContainer(props: SplitLayoutContainerProps) {
// <For> on plain ids for stable referential equality
const ids = createMemo(() => splits().map(({ id }) => id));
- createLayoutUrlSync(
- splitManager,
- () => props.pairs,
- previewQuery,
- decodedLayout,
- {
- navigate,
- search: () => location.search,
- hash: () => location.hash,
- }
- );
+ createLayoutUrlSync(splitManager, () => props.pairs, {
+ navigate,
+ search: () => location.search,
+ });
createSplitFocusTracker({ splitManager, panelRefs, splits });
return (
@@ -128,25 +106,7 @@ export function SplitLayoutContainer(props: SplitLayoutContainerProps) {
<Suspense>
<Resize.Panel
id={id}
- minSize={splitMinWidthForContent(handle().content(), {
- isPreviewController: handle().isControllerSplit(),
- })}
- // A Preview Pair is one layout unit: its two splits
- // share the space a single split would get. Both
- // members key their group by the Controller's id.
- shareGroup={
- splitManager.viewerOf(id) !== undefined
- ? id
- : splitManager.controllerOf(id)
- }
- // Automatic redistribution targets an engaged
- // Controller at its configured preferred width.
- // This is not a hard max: the gutter can still be
- // dragged past it.
- redistributionPreferredSize={splitManager.previewControllerWidth(
- id,
- viewportSize.width
- )}
+ minSize={DEFAULT_SPLIT_MIN_WIDTH}
index={index()}
>
<SplitPanel
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 6f50a41630..8f9d375add 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -20,7 +20,6 @@ import type { SetPredicatesInput } from '@app/features/next-soup/filters/filter-
import { mergeQuery } from '@app/features/next-soup/filters/filter-store/query-store';
import type { Query } from '@app/features/next-soup/filters/filter-store/types';
import { getViewPreset } from '@app/features/next-soup/sidebar/soup-filter-presets';
-import { NonMemberChannelPreview } from '@app/features/next-soup/soup-view/non-member-channel-preview';
import { SoupView } from '@app/features/next-soup/soup-view/soup-view';
import { useRecentViewFlag } from '@app/features/next-soup/use-recent-view-flag';
import { ReminderEditorSplit } from '@app/features/reminders/ReminderEditorSplit';
@@ -29,7 +28,6 @@ import { SettingsPanelComponentWrapper } from '@app/features/settings/Settings';
import { TasksView } from '@app/features/tasks-view/tasks-view';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { useFeatureFlag, usePosthog } from '@app/lib/analytics/posthog';
-import { globalSplitManager } from '@app/signal/splitLayout';
import { EventComposerSplit } from '@block-calendar/components/EventComposerSplit';
import { ChannelCompose } from '@block-channel/component/Compose';
import { ComposeSkill } from '@block-md/component/ComposeSkill';
@@ -53,9 +51,7 @@ import {
import { useUserContext } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type { ViewId } from '@core/types/view';
-import EmptyStatePreviewIcon from '@design/empty-state-doc.svg';
import { useAutomationEntities } from '@queries/agent-schedule/entities';
-import { EmptyStatePanel } from '@ui';
import {
type Component,
createRenderEffect,
@@ -68,7 +64,6 @@ import {
} from 'solid-js';
import type { SplitContent } from './layoutManager';
import { useSplitPanelOrThrow } from './layoutUtils';
-import { previewEmptyStateForContent } from './previewController';
function usePageViewTracking(pageTitle: string) {
const analytics = useAnalytics();
@@ -703,65 +698,6 @@ registerComponent(
/** END - APP ROUTES */
registerComponent('loading', () => <LoadingBlock />);
-// Placeholder a Preview Pair's Viewer opens before its Controller has
-// navigated anywhere (see layoutManager engagePreviewMode). Controllers can
-// override the copy via `emptyState` in previewController.ts; resolving it
-// from the live pair (rather than params) keeps the override across URL
-// restore.
-registerComponent('preview-empty', () => {
- const panel = useSplitPanelOrThrow();
- onMount(() => panel.handle.setDisplayName('Preview'));
- const emptyState = () => {
- const manager = globalSplitManager();
- const controllerId = manager?.controllerOf(panel.handle.id);
- const controllerContent = controllerId
- ? manager?.getSplit(controllerId)?.content()
- : undefined;
- return controllerContent
- ? previewEmptyStateForContent(controllerContent)
- : undefined;
- };
- return (
- <EmptyStatePanel
- graphic={EmptyStatePreviewIcon}
- title={emptyState()?.title ?? 'No content selected'}
- description={
- emptyState()?.description ??
- 'Select an item from the connected list to preview it here'
- }
- centered
- />
- );
-});
-// Join prompt for a channel the viewer can see but hasn't joined, shown in a
-// Preview Pair's Viewer when the controlling list focuses such a row (see
-// openEntityInSplitFromUnifiedList). Params don't round-trip through the URL,
-// so a restored split has none — fall back to the placeholder and let the
-// controller's focus→preview effect re-open the real prompt.
-registerComponent('non-member-channel', (params) => {
- const panel = useSplitPanelOrThrow();
- const channelId =
- typeof params?.channelId === 'string' ? params.channelId : undefined;
- if (!channelId) {
- return <RedirectSplit to={{ type: 'component', id: 'preview-empty' }} />;
- }
- const channelName =
- typeof params?.channelName === 'string' ? params.channelName : 'Channel';
- const memberCount =
- typeof params?.memberCount === 'number' ? params.memberCount : 0;
- onMount(() => panel.handle.setDisplayName(channelName));
- return (
- <NonMemberChannelPreview
- channelId={channelId}
- channelName={channelName}
- memberCount={memberCount}
- // Join landed — hand the Viewer off to the real channel block in place.
- onJoined={() =>
- panel.handle.replace({ next: { type: 'channel', id: channelId } })
- }
- />
- );
-});
registerComponent('channel-compose', () => {
usePageViewTracking('channel-compose');
return <ChannelCompose />;
diff --git a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
index 71d2e903b8..a8b37e4b1c 100644
--- a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
+++ b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
@@ -83,8 +83,6 @@ function PopoverSplitModal(props: {
toggleSpotlight: () => {},
isSpotLight: () => false,
isPopover: () => true,
- isViewerSplit: () => false,
- isControllerSplit: () => false,
replace: () => {},
// A popover has no URL and no history to rewrite.
adoptContentId: () => {},
@@ -108,11 +106,6 @@ function PopoverSplitModal(props: {
registerEntryStateCaptor: () => () => {},
captureEntryState: () => {},
currentEntryState: () => undefined,
- canEngagePreview: () => false,
- engagePreview: () => {},
- disengagePreview: () => {},
- resetPreview: () => {},
- viewerId: () => undefined,
};
const [bindHotKeyDom, scopeId] = useHotkeyDOMScope(
diff --git a/apps/web/src/components/app/split-layout/components/PreviewButton.tsx b/apps/web/src/components/app/split-layout/components/PreviewButton.tsx
deleted file mode 100644
index 512e74ecc9..0000000000
--- a/apps/web/src/components/app/split-layout/components/PreviewButton.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import { useAnalytics } from '@app/lib/analytics/analytics-context';
-import { TOKENS } from '@core/hotkey/tokens';
-import EyeIcon from '@phosphor-icons/core/regular/eye.svg?component-solid';
-import EyeSlashIcon from '@phosphor-icons/core/regular/eye-slash.svg?component-solid';
-import { Button, cn, Tooltip } from '@ui';
-import { Show } from 'solid-js';
-import { usePreviewToggle } from '../usePreviewToggle';
-
-/** Toggle Preview mode for eligible Controller content outside a Viewer. */
-export function PreviewButton(
- props: {
- disabled?: boolean;
- disabledLabel?: string;
- onEngage?: () => void;
- onOpenChange?: (open: boolean) => void;
- hideLabel?: boolean;
- iconOnly?: boolean;
- class?: string;
- registerHotkey?: boolean;
- } = {}
-) {
- const analytics = useAnalytics();
-
- const preview = usePreviewToggle({
- disabled: () => props.disabled ?? false,
- onEngage: () => {
- analytics.track('preview_panel_use');
- props.onEngage?.();
- },
- onOpenChange: props.onOpenChange,
- registerHotkey: props.registerHotkey ?? true,
- });
-
- const unavailableLabel = () =>
- props.disabled
- ? (props.disabledLabel ?? 'Preview unavailable')
- : 'No space for preview';
-
- return (
- <Show when={!preview.isViewer()}>
- <Tooltip
- hotkey={
- preview.canToggle() ? TOKENS.unifiedList.togglePreview : undefined
- }
- label={preview.canToggle() ? 'Preview' : unavailableLabel()}
- >
- <Button
- onClick={preview.toggle}
- variant="outline"
- size={props.iconOnly ? 'md' : 'sm'}
- square={props.iconOnly}
- depth={2}
- class={cn('bg-surface', props.class)}
- disabled={!preview.canToggle()}
- aria-label={props.hideLabel || props.iconOnly ? 'Preview' : undefined}
- >
- {preview.isOpen() ? <EyeSlashIcon /> : <EyeIcon />}
- <Show when={!props.hideLabel && !props.iconOnly}>
- <span>Preview</span>
- </Show>
- </Button>
- </Tooltip>
- </Show>
- );
-}
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index 5f47fa9f0d..5d3f49525d 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -206,7 +206,7 @@ function SplitCloseButton() {
});
return (
- <Show when={shouldShowSplitCloseButton(layout.manager, context.handle)}>
+ <Show when={shouldShowSplitCloseButton(layout.manager)}>
<Button
square
size="icon-sm"
@@ -474,18 +474,10 @@ function SplitHeaderContextMenu(props: ParentProps) {
disabled={!hasOtherSplits()}
onClick={() => {
const currentSplitId = panel.handle.id;
- // A Preview Pair is one unit: keep the current split's partner so
- // closing "other" splits from a Viewer doesn't strand it by
- // removing its Controller (or vice versa).
- const partnerId =
- layout.manager.controllerOf(currentSplitId) ??
- layout.manager.viewerOf(currentSplitId);
- const kept = new Set([currentSplitId, partnerId]);
-
const otherSplitIds = layout.manager
.splits()
.map((split) => split.id)
- .filter((id) => !kept.has(id));
+ .filter((id) => id !== currentSplitId);
for (const splitId of otherSplitIds) {
layout.manager.removeSplit(splitId);
diff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
index a27979e3d9..c7da140348 100644
--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
@@ -7,7 +7,6 @@ import { MobileTopEdgeFade } from '@components/app/mobile/MobileEdgeFade';
import { MobilePageActionRow } from '@components/app/mobile/MobilePageActionRow';
import { SplitPanelControllerProvider } from '@components/app/split-panel';
import { isSoloSettings } from '@core/constant/SettingsState';
-import { BlockOpenTrackingDelayContext } from '@core/context/blockOpenTracking';
import { splitContainerAttribute } from '@core/dom-selectors';
import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
@@ -51,12 +50,6 @@ type SplitPanelProps = {
index: number;
};
-/**
- * A Preview Pair Viewer displays content passively. Only record it as opened
- * after the user lingers, so keyboard scanning does not mark every row viewed.
- */
-const PREVIEW_VIEWER_OPEN_TRACK_DELAY_MS = 1_500;
-
export function SplitPanel(props: SplitPanelProps) {
const [attachHotKeys, splitHotkeyScope] = useHotkeyDOMScope(
`split=${props.split.id}`
@@ -99,7 +92,6 @@ export function SplitPanel(props: SplitPanelProps) {
});
},
isNotUnifiedList,
- isViewerSplit: () => props.handle.isViewerSplit(),
getSplitCount: () => splitLayoutHelpers.getSplitCount(),
toggleSpotlight: () => props.handle.toggleSpotlight(),
canGoForward: () => props.handle.canGoForward(),
@@ -188,24 +180,14 @@ export function SplitPanel(props: SplitPanelProps) {
goForward: props.handle.goForward,
canClose: () => {
const manager = globalSplitManager();
- return manager
- ? shouldShowSplitCloseButton(manager, props.handle)
- : false;
+ return manager ? shouldShowSplitCloseButton(manager) : false;
},
close: props.handle.close,
}}
>
<Suspense>
<SoupViewContextProvider soup={nextSoup}>
- <BlockOpenTrackingDelayContext.Provider
- value={
- props.handle.isViewerSplit()
- ? PREVIEW_VIEWER_OPEN_TRACK_DELAY_MS
- : 0
- }
- >
- <Dynamic component={props.split.mount.element} />
- </BlockOpenTrackingDelayContext.Provider>
+ <Dynamic component={props.split.mount.element} />
</SoupViewContextProvider>
</Suspense>
</SplitPanelControllerProvider>
diff --git a/apps/web/src/components/app/split-layout/layout.ts b/apps/web/src/components/app/split-layout/layout.ts
index df9cc9f082..e46da3366d 100644
--- a/apps/web/src/components/app/split-layout/layout.ts
+++ b/apps/web/src/components/app/split-layout/layout.ts
@@ -24,12 +24,8 @@ export function useSplitLayout() {
return;
}
- // Navigation issued from inside a split panel (links, mentions, references)
- // carries that panel as its source; callers outside any panel (sidebar,
- // command menu) stay handle-less, which is what marks "external navigation"
- // for Preview Pair routing. A popover's SplitPanelContext handle is a stub
- // whose replace() is a no-op, so treat popover sources as handle-less too
- // and let same-split navigation fall back to the active split.
+ // Use the source panel for navigation. Popover handles cannot replace
+ // content, so navigation from a popover falls back to the active split.
const requestedHandle = options?.handle ?? splitPanelContext?.handle;
const handle = requestedHandle?.isPopover() ? undefined : requestedHandle;
diff --git a/apps/web/src/components/app/split-layout/layoutManager.ts b/apps/web/src/components/app/split-layout/layoutManager.ts
index 3818dcdac6..e7ce8daa1f 100644
--- a/apps/web/src/components/app/split-layout/layoutManager.ts
+++ b/apps/web/src/components/app/split-layout/layoutManager.ts
@@ -14,7 +14,6 @@ import { toast } from '@core/component/Toast/Toast';
import { isBlockAlias, resolveBlockAlias } from '@core/constant/allBlocks';
import { settingsTabToSlug } from '@core/constant/settingsTabsConfig';
import { sameContentIdentity } from '@core/contentInstanceRegistry';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import type {
BlockInstanceHandle,
BlockOrchestrator,
@@ -30,27 +29,16 @@ import {
onCleanup,
} from 'solid-js';
import { createStore, produce, reconcile, type Store } from 'solid-js/store';
-import { match } from 'ts-pattern';
import {
type ComponentMeta,
type ComponentMetaMap,
resolveComponent,
} from './componentRegistry';
import { createHistory, type History } from './history';
-import {
- isPreviewControllerContent,
- previewControllerWidthForContent,
-} from './previewController';
import { DEFAULT_SPLIT_MIN_WIDTH } from './splitContentSizing';
const ENABLE_DEFAULT_ALWAYS_IN_HISTORY = false;
-/** Placeholder content a Preview Pair's Viewer opens before any navigation. */
-const PREVIEW_VIEWER_EMPTY_CONTENT = {
- type: 'component',
- id: 'preview-empty',
-} as const;
-
export type SplitId = string & { readonly SplitId: unique symbol };
type SplitKey = `${BlockName | BlockAlias | 'component'}:${string}`;
@@ -218,13 +206,6 @@ export type OpenWithSplitOptions = {
replaceWhenFull?: boolean;
/** If true, prefers opening in a new split. May still replace if layout is at capacity. */
preferNewSplit?: boolean;
- /**
- * Open in place of the whole Preview Pair: the Viewer closes, preview mode
- * disengages, and the content replaces the Controller — the same shape as
- * external replacement navigation, but asked for deliberately. Ignored when
- * the navigation does not come from a live Preview Pair.
- */
- replacePreview?: boolean;
insertIndex?: number;
handle?: SplitHandle;
/**
@@ -237,12 +218,6 @@ export type OpenWithSplitOptions = {
reopen?: 'latest';
};
-/**
- * A live Preview Pair: navigation in the Controller is redirected into its
- * immediately-adjacent Viewer.
- */
-export type PreviewPair = { controllerId: SplitId; viewerId: SplitId };
-
/**
* A navigation interceptor registered by, e.g. mobile swipe layout.
* Called at the start of `openWithSplit`. Return `{ handled: true }` to consume
@@ -430,54 +405,6 @@ export type SplitManager = {
*/
setNavigationInterceptor: (fn: NavigationInterceptor | undefined) => void;
- /**
- * Engage preview mode on a split: it becomes the Controller in a Preview
- * Pair with an eagerly-created Viewer, and navigation routes between them by
- * configured controller capability. No-op on mobile and when there is no
- * room for the Viewer.
- */
- engagePreviewMode: (controllerId: SplitId) => void;
-
- /** Restore a Preview Pair using an existing adjacent Viewer. */
- restorePreviewPair: (controllerId: SplitId, viewerId: SplitId) => boolean;
-
- /**
- * Whether preview mode can engage on this split — requires room for the
- * Viewer (or an adoptable placeholder already on screen). Reactive.
- */
- canEngagePreview: (controllerId: SplitId) => boolean;
-
- /** Exit preview mode and close the Preview Pair's Viewer. */
- disengagePreviewMode: (controllerId: SplitId) => void;
-
- /**
- * Return the Preview Pair's Viewer to its empty placeholder, e.g. when the
- * Controller's list changes wholesale and the previewed entity no longer
- * corresponds to a selected row. Replaces the Viewer's current entry (like
- * Controller-originated selection navigation) rather than stacking a
- * placeholder entry. No-op without a Viewer or when it already shows the
- * placeholder.
- */
- resetPreviewMode: (controllerId: SplitId) => void;
-
- /** Preserve both splits while unlinking their Preview Pair. */
- unlinkPreviewPair: (controllerId: SplitId) => void;
-
- /** The automatic-redistribution preference for a Controller. Reactive. */
- previewControllerWidth: (
- controllerId: SplitId,
- viewportWidth?: number
- ) => number | undefined;
-
- /** The Controller's live Viewer id, if one exists. Reactive. */
- viewerOf: (controllerId: SplitId) => SplitId | undefined;
-
- /** The controller whose viewer is the given split, if any. Reactive. */
- controllerOf: (viewerId: SplitId) => SplitId | undefined;
-
- /** All live, immediately-adjacent Preview Pairs. */
- previewPairs: Accessor<PreviewPair[]>;
-
/** Get reactive accessor to popovers map */
popovers: () => Map<
string,
@@ -531,10 +458,6 @@ export type SplitHandle<TMeta extends ComponentMeta = ComponentMeta> = {
content: () => SplitContent;
isSpotLight: () => boolean;
isPopover: () => boolean;
- /** Whether this split is the Viewer side of a Preview Pair. */
- isViewerSplit: () => boolean;
- /** Whether this split is the Controller side of a Preview Pair. */
- isControllerSplit: () => boolean;
displayName: () => string;
canGoBack: () => boolean;
isActive: () => boolean;
@@ -587,16 +510,6 @@ export type SplitHandle<TMeta extends ComponentMeta = ComponentMeta> = {
* Returns `undefined` if no state has been captured.
*/
currentEntryState: () => EntryState | undefined;
- /** Whether preview mode can engage on this split (room for a viewer). */
- canEngagePreview: () => boolean;
- /** Engage preview mode on this split (see SplitManager.engagePreviewMode). */
- engagePreview: () => void;
- /** Exit preview mode and close this Controller's Viewer. */
- disengagePreview: () => void;
- /** Return this Controller's Viewer to its placeholder (see SplitManager.resetPreviewMode). */
- resetPreview: () => void;
- /** This Controller's live Viewer id, if one exists. Reactive. */
- viewerId: () => SplitId | undefined;
} & UrlCapabilities;
function newSplitId(): SplitId {
@@ -686,13 +599,6 @@ export function createSplitLayout(
lastActiveSplitId: SplitId | undefined;
spotlightId: SplitId | undefined;
events: SplitEventWithType[];
- /**
- * Preview Pairs keyed by Controller id. Key present = preview mode
- * engaged on that split, and the Viewer always exists (engage
- * refuses to run without room for one). IDs remain in-memory only;
- * SplitLayout persists stable URL-order indices for reload restoration.
- */
- previewPairs: Record<SplitId, { viewerId: SplitId }>;
popovers: Map<
string,
{
@@ -710,7 +616,6 @@ export function createSplitLayout(
lastActiveSplitId: undefined,
spotlightId: undefined,
events: [],
- previewPairs: {},
popovers: new Map(),
});
@@ -938,11 +843,6 @@ export function createSplitLayout(
};
return s.with(i, target);
});
-
- // Content changes that bypass Preview Pair routing (direct handle.replace,
- // history back/forward) can violate its content invariant; unlink the
- // Preview Pair when they do.
- enforcePreviewPairContentInvariant(split.id);
}
function back(id: SplitId) {
@@ -961,7 +861,6 @@ export function createSplitLayout(
if (!prev) return;
reattach(split, prev, undefined, 'history-back');
- resetPreviewMode(id);
});
}
@@ -1003,7 +902,6 @@ export function createSplitLayout(
result.moved = true;
reattach(split, prev, undefined, 'history-back');
- resetPreviewMode(id);
});
return result.moved;
@@ -1025,7 +923,6 @@ export function createSplitLayout(
if (!next) return;
reattach(split, next, undefined, 'history-forward');
- resetPreviewMode(id);
});
}
@@ -1283,18 +1180,7 @@ export function createSplitLayout(
return;
}
- // Closing a Preview Pair's Controller closes its Viewer too. Remove
- // the Viewer first so the Controller's final remove event determines
- // which remaining split receives focus. One atomic mutation: a flush
- // between the removals would let a pending preview engagement (a
- // split waiting on room, see soup-view's initial-preview effect)
- // insert its Viewer into the still-crowded layout, min-crushing
- // every panel and scrambling the freed space's redistribution.
- batch(() => {
- const viewerId = viewerOf(currentSplit.id);
- if (viewerId) removeSplit(viewerId, false);
- removeSplit(currentSplit.id);
- });
+ removeSplit(currentSplit.id);
},
getUrlSegments: () => contentUrlSegments(content()),
getUrl: () => contentUrlSegments(content()).join('/'),
@@ -1303,8 +1189,6 @@ export function createSplitLayout(
isActive: () => currentSplit.id === state.activeSplitId,
isSpotLight: () => state.spotlightId === currentSplit.id,
isPopover: () => state.popovers.has(currentSplit.id),
- isViewerSplit: () => controllerOf(currentSplit.id) !== undefined,
- isControllerSplit: () => viewerOf(currentSplit.id) !== undefined,
toggleSpotlight: (force?: boolean) => {
toggleSpotlightSplit(currentSplit.id, force);
},
@@ -1367,11 +1251,6 @@ export function createSplitLayout(
const c = live.content as { state?: EntryState };
return c.state;
},
- canEngagePreview: () => canEngagePreview(currentSplit.id),
- engagePreview: () => engagePreviewMode(currentSplit.id),
- disengagePreview: () => disengagePreviewMode(currentSplit.id),
- resetPreview: () => resetPreviewMode(currentSplit.id),
- viewerId: () => viewerOf(currentSplit.id),
};
};
@@ -1414,7 +1293,6 @@ export function createSplitLayout(
);
return nextSplits;
});
- pruneNonAdjacentPreviewPairs();
});
const handle = getSplit(split.id)!;
@@ -1439,11 +1317,7 @@ export function createSplitLayout(
contentChangeListeners.delete(id);
entryStateCaptors.delete(id);
- // One atomic mutation: clearing the Preview Pair and removing the split
- // must reach reactive consumers together, so the departing split's panel
- // still carries its pair share-group when the resize solver drops it.
batch(() => {
- clearPreviewPairsFor(id);
setSplitNamesById(
produce((map) => {
delete map[id];
@@ -1462,347 +1336,25 @@ export function createSplitLayout(
});
}
- function splitGroupBounds(
- id: SplitId
- ): readonly [number, number] | undefined {
- const index = splitIndexById(id);
- if (index < 0) return undefined;
-
- const viewerId = state.previewPairs[id]?.viewerId;
- if (viewerId && state.splits[index + 1]?.id === viewerId) {
- return [index, index + 1];
- }
-
- const controllerIndex = state.splits.findIndex(
- (split) => state.previewPairs[split.id]?.viewerId === id
- );
- if (controllerIndex >= 0 && controllerIndex + 1 === index) {
- return [controllerIndex, index];
- }
-
- return [index, index];
- }
-
function canSwapSplit(id: SplitId, direction: 'left' | 'right') {
- const bounds = splitGroupBounds(id);
- if (!bounds) return false;
-
- const targetIndex = direction === 'left' ? bounds[0] - 1 : bounds[1] + 1;
- return targetIndex >= 0 && targetIndex < state.splits.length;
+ const index = splitIndexById(id);
+ const target = index + (direction === 'left' ? -1 : 1);
+ return index >= 0 && target >= 0 && target < state.splits.length;
}
function swapSplit(id: SplitId, direction: 'left' | 'right') {
- const bounds = splitGroupBounds(id);
- if (!bounds) return;
-
- const targetIndex = direction === 'left' ? bounds[0] - 1 : bounds[1] + 1;
- if (targetIndex < 0 || targetIndex >= state.splits.length) return;
-
+ if (!canSwapSplit(id, direction)) return;
+ const index = splitIndexById(id);
+ const targetIndex = index + (direction === 'left' ? -1 : 1);
const target = state.splits[targetIndex];
- if (!target) return;
- const targetBounds = splitGroupBounds(target.id);
- if (!targetBounds) return;
-
- const [sourceStart, sourceEnd] = bounds;
- const [targetStart, targetEnd] = targetBounds;
- const [leftStart, leftEnd, rightStart, rightEnd] =
- sourceStart < targetStart
- ? [sourceStart, sourceEnd, targetStart, targetEnd]
- : [targetStart, targetEnd, sourceStart, sourceEnd];
-
batch(() => {
resizeContext()?.swap(id, target.id);
- setState('splits', (splits) => {
- return [
- ...splits.slice(0, leftStart),
- ...splits.slice(rightStart, rightEnd + 1),
- ...splits.slice(leftEnd + 1, rightStart),
- ...splits.slice(leftStart, leftEnd + 1),
- ...splits.slice(rightEnd + 1),
- ];
- });
- });
- }
-
- /**
- * An unclaimed placeholder split sitting immediately right of the
- * controller that engage adopts as the viewer instead of creating a
- * duplicate.
- */
- function adoptableViewerFor(controllerId: SplitId): SplitId | undefined {
- const controllerIndex = splitIndexById(controllerId);
- const adjacent =
- controllerIndex >= 0 ? state.splits[controllerIndex + 1] : undefined;
- if (
- adjacent &&
- sameContent(adjacent.content, PREVIEW_VIEWER_EMPTY_CONTENT) &&
- !controllerOf(adjacent.id)
- ) {
- return adjacent.id;
- }
- return undefined;
- }
-
- /**
- * Whether preview mode can engage on this split: there must be room for
- * the Viewer (or an adoptable placeholder already on screen).
- * Reactive.
- */
- function canEngagePreview(controllerId: SplitId): boolean {
- if (isTouchDevice()) return false;
- const controller = findSplitById(controllerId);
- if (
- !controller ||
- isExcluded(controller) ||
- !isPreviewControllerContent(controller.content) ||
- controllerOf(controllerId) !== undefined
- ) {
- return false;
- }
- if (viewerOf(controllerId) !== undefined) return true;
- return adoptableViewerFor(controllerId) !== undefined || canAppendSplit();
- }
-
- /** Whether two live splits can form a non-overlapping adjacent Preview Pair. */
- function canLinkPreviewPair(
- controllerId: SplitId,
- viewerId: SplitId
- ): boolean {
- if (isTouchDevice()) return false;
- const controllerIndex = splitIndexById(controllerId);
- const controller = state.splits[controllerIndex];
- const viewer = state.splits[controllerIndex + 1];
- if (
- !controller ||
- controller.id !== controllerId ||
- !viewer ||
- viewer.id !== viewerId ||
- isExcluded(controller) ||
- isExcluded(viewer)
- ) {
- return false;
- }
- if (!isPreviewControllerContent(controller.content)) {
- return false;
- }
-
- // Neither side can already participate in another Preview Pair.
- return (
- state.previewPairs[controllerId] === undefined &&
- state.previewPairs[viewerId] === undefined &&
- controllerOf(controllerId) === undefined &&
- controllerOf(viewerId) === undefined
- );
- }
-
- /** The sole creator of Controller/Viewer Preview Pairs. */
- function linkPreviewPair(controllerId: SplitId, viewerId: SplitId): boolean {
- if (!canLinkPreviewPair(controllerId, viewerId)) return false;
- setState('previewPairs', controllerId, { viewerId });
-
- // A restored layout comes up with its last split — often the viewer — as
- // active. The controller owns the keyboard when its viewer is active only
- // because it was the last URL entry, so return activation to it.
- if (state.activeSplitId === viewerId) {
- activateSplit(controllerId);
- }
- return true;
- }
-
- /**
- * Structural split mutations may not leave a Preview Pair whose Viewer is
- * anywhere except immediately right of its Controller.
- */
- function pruneNonAdjacentPreviewPairs() {
- setState(
- 'previewPairs',
- produce((map) => {
- for (const controllerId of Object.keys(map) as SplitId[]) {
- const controllerIndex = splitIndexById(controllerId);
- if (
- controllerIndex < 0 ||
- state.splits[controllerIndex + 1]?.id !==
- map[controllerId]?.viewerId
- ) {
- delete map[controllerId];
- }
- }
- })
- );
- }
-
- function restorePreviewPair(
- controllerId: SplitId,
- viewerId: SplitId
- ): boolean {
- return linkPreviewPair(controllerId, viewerId);
- }
-
- function engagePreviewMode(controllerId: SplitId) {
- // Mobile shows one panel at a time; a side-by-side viewer cannot exist.
- if (isTouchDevice()) return;
- const controller = findSplitById(controllerId);
- if (!controller || !isPreviewControllerContent(controller.content)) return;
- if (state.previewPairs[controllerId] !== undefined) return;
- if (controllerOf(controllerId) !== undefined) return;
-
- // The viewer opens with its placeholder immediately; navigation then
- // replaces its content. Adopt an unclaimed placeholder already sitting
- // right of the controller instead of duplicating it. Without room for a
- // viewer, preview mode does not engage at all.
- //
- // Creating the viewer and linking the Preview Pair is one atomic
- // mutation: the viewer's resize panel must register with its pair
- // share-group already in place so it carves its width out of the
- // Controller instead of every split.
- batch(() => {
- let viewerId = adoptableViewerFor(controllerId);
- if (viewerId === undefined) {
- if (!canAppendSplit()) return;
- const controllerIndex = splitIndexById(controllerId);
- const viewerHandle = createNewSplit({
- content: PREVIEW_VIEWER_EMPTY_CONTENT,
- activate: false,
- referredFrom: null,
- allowDuplicate: true,
- insertIndex: controllerIndex >= 0 ? controllerIndex + 1 : undefined,
- });
- if (!viewerHandle) return;
- viewerId = viewerHandle.id;
- }
- linkPreviewPair(controllerId, viewerId);
- });
-
- // The Controller's configured width is enforced declaratively as an
- // automatic-redistribution preference and maximum (see
- // SplitLayoutContainer). Direct gutter drags remain unconstrained by it.
- }
-
- function unlinkPreviewPair(controllerId: SplitId) {
- setState(
- 'previewPairs',
- produce((map) => {
- delete map[controllerId];
- })
- );
- }
-
- function disengagePreviewMode(controllerId: SplitId) {
- // Atomic for the same reason as removeSplit: the viewer's panel must
- // still carry its pair share-group when the resize solver drops it, so
- // its width returns to the Controller rather than every split.
- batch(() => {
- const viewerId = viewerOf(controllerId);
- unlinkPreviewPair(controllerId);
- if (viewerId) removeSplit(viewerId);
- });
- }
-
- function resetPreviewMode(controllerId: SplitId) {
- const viewerId = viewerOf(controllerId);
- if (viewerId === undefined) return;
- const viewer = getSplit(viewerId);
- if (!viewer) return;
- const content = viewer.content();
- if (
- content.type === PREVIEW_VIEWER_EMPTY_CONTENT.type &&
- content.id === PREVIEW_VIEWER_EMPTY_CONTENT.id
- ) {
- return;
- }
- viewer.replace({
- next: PREVIEW_VIEWER_EMPTY_CONTENT,
- referredFrom: null,
- // Like Controller-originated selection navigation, the reset replaces
- // the Viewer's current entry instead of stacking a placeholder entry.
- mergeHistory: true,
+ setState('splits', (splits) =>
+ splits.with(index, splits[targetIndex]).with(targetIndex, splits[index])
+ );
});
}
- const previewControllerWidth = (
- controllerId: SplitId,
- viewportWidth?: number
- ) => {
- if (viewerOf(controllerId) === undefined) return undefined;
- const content = findSplitById(controllerId)?.content;
- return content
- ? previewControllerWidthForContent(content, viewportWidth)
- : undefined;
- };
-
- const viewerOf = (controllerId: SplitId): SplitId | undefined => {
- return state.previewPairs[controllerId]?.viewerId;
- };
-
- const controllerOf = (viewerId: SplitId): SplitId | undefined => {
- for (const [controllerId, previewPair] of Object.entries(
- state.previewPairs
- )) {
- if (previewPair.viewerId === viewerId) {
- return controllerId as SplitId;
- }
- }
- return undefined;
- };
-
- const previewPairs = createMemo<PreviewPair[]>(() => {
- return Object.entries(state.previewPairs).map(
- ([controllerId, { viewerId }]) => ({
- controllerId: controllerId as SplitId,
- viewerId,
- })
- );
- });
-
- /** Called whenever split `id` leaves the layout. */
- function clearPreviewPairsFor(id: SplitId) {
- setState(
- 'previewPairs',
- produce((map) => {
- // Controller removed outside its close action: Preview Pair gone, its
- // Viewer stays. SplitHandle.close removes the Viewer first.
- delete map[id];
- for (const key of Object.keys(map) as SplitId[]) {
- // Viewer closed (✕ button, hotkey, reconcile): preview mode
- // disengages on its controller.
- if (map[key]?.viewerId === id) delete map[key];
- }
- })
- );
- }
-
- /** The Preview Pair a split belongs to, seen from either side. */
- function previewPairOf(id: SplitId): PreviewPair | undefined {
- const viewerId = state.previewPairs[id]?.viewerId;
- if (viewerId !== undefined) return { controllerId: id, viewerId };
- const controllerId = controllerOf(id);
- if (controllerId) return { controllerId, viewerId: id };
- return undefined;
- }
-
- /**
- * A Preview Pair consists of an eligible Controller and its Viewer. A block
- * such as a project may be eligible to act as a Controller while also being
- * valid Viewer content; the live pair assignment, rather than content type,
- * determines its role.
- *
- * Content changes that reach the Controller outside `openWithSplit` (direct
- * `handle.replace`, history back/forward, URL reconcile) can make it
- * ineligible; when they do, the Preview Pair closes.
- */
- function enforcePreviewPairContentInvariant(id: SplitId) {
- const split = findSplitById(id);
- if (!split) return;
-
- // Controller side: ineligible content breaks the Preview Pair.
- if (
- viewerOf(id) !== undefined &&
- !isPreviewControllerContent(split.content)
- ) {
- disengagePreviewMode(id);
- }
- }
-
function hasSplit(type: SplitContentType, id: string): boolean {
return !!state.splits.find(
(s) => s.content.type === type && s.content.id === id
@@ -1915,17 +1467,12 @@ export function createSplitLayout(
resultSplits.push(newSplit);
}
- // Update order and unlink any Preview Pair that the rebuild separated
- // before reactive consumers can observe the new split layout. Removed
- // splits are cleaned up in the same atomic mutation so a removed
- // Preview Pair member's panel still carries its pair share-group when
- // the resize solver drops it.
+ // Update the layout and clean up removed splits atomically.
batch(() => {
for (const split of state.splits) {
if (!usedIds.has(split.id)) {
contentChangeListeners.delete(split.id);
entryStateCaptors.delete(split.id);
- clearPreviewPairsFor(split.id);
setSplitNamesById(
produce((map) => {
delete map[split.id];
@@ -1936,17 +1483,7 @@ export function createSplitLayout(
}
setState('splits', resultSplits);
- pruneNonAdjacentPreviewPairs();
});
-
- // URL-driven rebuilds can swap a Preview Pair member's content in place
- // (same id, new content) — enforce its content invariant here too.
- for (const [controllerId, previewPair] of Object.entries(
- state.previewPairs
- )) {
- enforcePreviewPairContentInvariant(controllerId as SplitId);
- enforcePreviewPairContentInvariant(previewPair.viewerId);
- }
}
const lastEvent = createMemo(() => state.events[state.events.length - 1]);
@@ -2047,42 +1584,6 @@ export function createSplitLayout(
}
}
- /**
- * Where a navigation lands when its source belongs to a live Preview Pair.
- *
- * - `dissolve`: the Viewer closes and the content replaces the Controller.
- * - `into-viewer`: the content previews in the Viewer, which never takes the
- * keyboard from the Controller.
- * - `unchanged`: the navigation stands on its own — a new split, or the
- * Viewer replacing itself like any other split.
- */
- type PreviewRoute = 'dissolve' | 'into-viewer' | 'unchanged';
-
- function previewRouteFor(
- previewPair: PreviewPair,
- explicitSourceId: SplitId | undefined,
- options: OpenWithSplitOptions
- ): PreviewRoute {
- // Asking to replace the preview outranks everything else.
- if (options.replacePreview) return 'dissolve';
-
- // Explicit new-split intent stands on its own while there is room for it,
- // which leaves the Preview Pair intact. Without room it falls back to the
- // replacement routing below — into the Viewer, never the Controller.
- if (options.preferNewSplit && canAppendSplit()) return 'unchanged';
-
- // External (handle-less) replacement navigation, e.g. the sidebar or the
- // command menu, takes the pair's place. Handle-less create-new actions are
- // not replacements, and were already answered above.
- if (explicitSourceId === undefined) return 'dissolve';
-
- // A Controller selection previews; anything else (notably the Viewer
- // navigating itself) replaces its own split.
- return explicitSourceId === previewPair.controllerId
- ? 'into-viewer'
- : 'unchanged';
- }
-
function openWithSplit(
content: SplitContent,
options: OpenWithSplitOptions = {}
@@ -2109,75 +1610,13 @@ export function createSplitLayout(
if (result.handled) return undefined;
}
- // Preview Pair routing (see previewRouteFor for the rules). Options are
- // rewritten once, never recursively. Runs before the duplicate
- // short-circuit so an existing-content hit can never activate (and focus)
- // another split while the Controller holds the keyboard.
- const explicitSourceId = options.handle?.id;
- const previewSourceId = explicitSourceId ?? state.activeSplitId;
- const sourcePreviewPair = previewSourceId
- ? previewPairOf(previewSourceId)
- : undefined;
- const previewPair =
- sourcePreviewPair && findSplitById(sourcePreviewPair.viewerId)
- ? sourcePreviewPair
- : undefined;
- const previewRoute: PreviewRoute = previewPair
- ? previewRouteFor(previewPair, explicitSourceId, options)
- : 'unchanged';
-
- if (previewPair) {
- options = match(previewRoute)
- .with('dissolve', () => {
- disengagePreviewMode(previewPair.controllerId);
- return {
- ...options,
- handle: getSplit(previewPair.controllerId),
- preferNewSplit: false,
- insertIndex: undefined,
- };
- })
- .with('into-viewer', () => ({
- ...options,
- handle: getSplit(previewPair.viewerId),
- preferNewSplit: false,
- activate: false,
- insertIndex: undefined,
- // Controller-originated navigation is transient selection state,
- // not preview history: it replaces the Viewer's current
- // entry, so only the preview's own navigation stacks up.
- mergeHistory: true,
- }))
- .with('unchanged', () => options)
- .exhaustive();
- }
-
const existingSplit = getSplitByContent(content.type, content.id);
- // Promoting the previewed row into a split of its own: the Viewer's copy is
- // the preview being superseded, not a competing split, so it must not
- // short-circuit into "activate what is already open". The Viewer drops back
- // to its placeholder once the content has a real split (see below), so the
- // content still lives in exactly one place. An `unchanged` route with
- // new-split intent is precisely the case where the split has room to exist.
- const promotedPreviewPair =
- previewPair !== undefined &&
- previewRoute === 'unchanged' &&
- options.preferNewSplit === true &&
- explicitSourceId === previewPair.controllerId &&
- existingSplit?.id === previewPair.viewerId
- ? previewPair
- : undefined;
-
if (
existingSplit &&
- !promotedPreviewPair &&
(contentIdentity(content).type !== 'component' || !options.allowDuplicate)
) {
- // A controller selection can resolve to content already mounted in its
- // own viewer (notably two rows from one channel). Refresh the viewer's
- // merged history entry so per-entry source metadata follows the latest
- // selection instead of being stranded on the first row.
+ // Preserve per-entry state when the owning split replaces its current entry.
if (options.mergeHistory && options.handle?.id === existingSplit.id) {
existingSplit.captureEntryState();
const currentState = existingSplit.currentEntryState();
@@ -2228,13 +1667,6 @@ export function createSplitLayout(
return splitHandle;
} else {
- // The promoted content is about to own a real split, so clear the preview
- // it came from first: it must never sit in two splits at once, and a
- // Viewer still holding it would make createNewSplit dedupe into it.
- if (promotedPreviewPair) {
- resetPreviewMode(promotedPreviewPair.controllerId);
- }
-
return createNewSplit({
content,
activate: options.activate ?? true,
@@ -2267,7 +1699,7 @@ export function createSplitLayout(
}
// Atomic for the same reason as SplitHandle.close: no flush between
- // removals, so pending preview engagements only see the final layout.
+ // removals, so observers only see the final layout.
batch(() => {
for (const split of visibleSplits) {
if (split.id !== splitToKeep.id) {
@@ -2344,15 +1776,5 @@ export function createSplitLayout(
setNavigationInterceptor: (fn) => {
navigationInterceptor = fn;
},
- engagePreviewMode,
- restorePreviewPair,
- canEngagePreview,
- disengagePreviewMode,
- resetPreviewMode,
- unlinkPreviewPair,
- previewControllerWidth,
- viewerOf,
- controllerOf,
- previewPairs,
};
}
diff --git a/apps/web/src/components/app/split-layout/layoutUrlSync.ts b/apps/web/src/components/app/split-layout/layoutUrlSync.ts
index 1e3a23dfbd..491db55a4e 100644
--- a/apps/web/src/components/app/split-layout/layoutUrlSync.ts
+++ b/apps/web/src/components/app/split-layout/layoutUrlSync.ts
@@ -1,7 +1,6 @@
import type { Navigator } from '@solidjs/router';
import {
type Accessor,
- batch,
createEffect,
createMemo,
on,
@@ -9,18 +8,10 @@ import {
} from 'solid-js';
import type { SplitContent, SplitManager } from './layoutManager';
import { decodePairs } from './layoutUtils';
-import {
- PREVIEW_QUERY_PARAM,
- type PreviewPairUrlEntry,
- type PreviewQueryValue,
- type RestorablePreviewLayout,
- serializePreviewPairs,
-} from './previewPersistence';
type LayoutUrlSyncEnvironment = {
navigate: Navigator;
search: Accessor<string>;
- hash: Accessor<string>;
};
function sameSplitContentIdentity(a: SplitContent, b: SplitContent) {
@@ -46,48 +37,14 @@ function getUrlSyncAffectedSplit(
.find((split) => sameSplitContentIdentity(split.content, affectedPair));
}
-/** Restore URL-declared Preview Pairs through the manager's invariant gate. */
-export function restorePreviewPairs(
- splitManager: SplitManager,
- previewPairs: readonly PreviewPairUrlEntry[]
-) {
- const splits = splitManager.splits();
- for (const previewPair of previewPairs) {
- const controller = splits[previewPair.controllerIndex];
- const viewer = splits[previewPair.controllerIndex + 1];
- if (!controller || !viewer) continue;
- splitManager.restorePreviewPair(controller.id, viewer.id);
- }
-}
-
-function previewPairsForUrl(splitManager: SplitManager): PreviewPairUrlEntry[] {
- const splits = splitManager.getVisibleSplits();
- const indices = new Map(splits.map((split, index) => [split.id, index]));
- return splitManager
- .previewPairs()
- .flatMap((previewPair): PreviewPairUrlEntry[] => {
- const controllerIndex = indices.get(previewPair.controllerId);
- return controllerIndex === undefined ? [] : [{ controllerIndex }];
- });
-}
-
-function previewQueryMatches(
- current: PreviewQueryValue,
- canonical: string | undefined
-): boolean {
- return current === canonical;
-}
-
/**
- * Keep the split manager and the path/query representation of its layout in
+ * Keep the split manager and the path representation of its layout in
* sync. Router access is injected so the reactive behavior can be tested
* without mounting the complete split UI.
*/
export function createLayoutUrlSync(
splitManager: SplitManager,
pairs: Accessor<string[]>,
- previewQuery: Accessor<PreviewQueryValue>,
- decodedLayout: Accessor<RestorablePreviewLayout>,
environment: LayoutUrlSyncEnvironment
) {
let reconcilingFromUrl = false;
@@ -97,71 +54,41 @@ export function createLayoutUrlSync(
disposed = true;
});
- const managerUrlState = () => {
- const segments = splitManager.getUrlSegments();
- const preview = serializePreviewPairs(previewPairsForUrl(splitManager));
- return { segments, preview };
- };
-
- const managerUrlSignature = () => {
- const state = managerUrlState();
- return JSON.stringify([state.segments, state.preview]);
- };
-
- const urlLayoutDrift = createMemo(() => {
- const state = managerUrlState();
- return (
- state.segments.join('/') !== pairs().join('/') ||
- !previewQueryMatches(previewQuery(), state.preview)
- );
- });
+ const managerUrlSignature = () => splitManager.getUrlSegments().join('/');
+ const urlLayoutDrift = createMemo(
+ () => managerUrlSignature() !== pairs().join('/')
+ );
const syncManagerToUrl = (options: { replace?: boolean } = {}) => {
if (!urlLayoutDrift()) return;
- const nextState = managerUrlState();
- const pathChanged = nextState.segments.join('/') !== pairs().join('/');
+ const segments = splitManager.getUrlSegments();
const currentQuery = new URLSearchParams(environment.search());
// Action links can mount before settings has selected its requested tab.
// Preserve their query until the wrapper has canonicalized that tab.
if (
- pathChanged &&
pairs()[0] === 'settings' &&
((pairs()[1] === 'harness' && currentQuery.get('pair')) ||
(pairs()[1] === 'agents' && currentQuery.get('createAgent') === 'true'))
) {
return;
}
- const nextPairs = decodePairs(nextState.segments);
+ const nextPairs = decodePairs(segments);
const affectedSplit = getUrlSyncAffectedSplit(
splitManager,
- decodedLayout().contents,
+ decodePairs(pairs()),
nextPairs
);
const replace =
options.replace ?? affectedSplit?.lastNavigationCause === 'replace';
- // Preserve unrelated query/hash state for query-only updates. Path
- // changes retain the existing split-navigation behavior of clearing
- // content-specific location state.
- const query = pathChanged ? new URLSearchParams() : currentQuery;
- if (nextState.preview) {
- query.set(PREVIEW_QUERY_PARAM, nextState.preview);
- } else {
- query.delete(PREVIEW_QUERY_PARAM);
- }
- const search = query.toString();
- const hash = pathChanged ? '' : environment.hash();
- const nextUrl = `/${nextState.segments.join('/')}${
- search ? `?${search}` : ''
- }${hash}`;
+ // Path changes clear content-specific query and hash locations.
+ const nextUrl = `/${segments.join('/')}`;
environment.navigate(nextUrl, { replace });
};
- // Preview operations can update splits and their Preview Pair in separate
- // reactive writes. Coalesce those writes so the URL never observes an
- // intermediate bare placeholder or severed Preview Pair.
+ // Coalesce batched layout mutations into one URL update.
const scheduleManagerToUrlSync = () => {
if (managerSyncQueued) return;
managerSyncQueued = true;
@@ -171,7 +98,7 @@ export function createLayoutUrlSync(
});
};
- /** Sync changes from the layout manager to path and query together. */
+ /** Sync changes from the layout manager to the URL path. */
createEffect(
on(
managerUrlSignature,
@@ -182,26 +109,19 @@ export function createLayoutUrlSync(
)
);
- /** Sync changes from either URL path or preview query to the manager. */
+ /** Sync changes from the URL path to the manager. */
createEffect(
- on([pairs, previewQuery], () => {
+ on(pairs, () => {
if (urlLayoutDrift()) {
- const nextLayout = decodedLayout();
+ const nextContents = decodePairs(pairs());
reconcilingFromUrl = true;
try {
- batch(() => {
- for (const previewPair of splitManager.previewPairs()) {
- splitManager.unlinkPreviewPair(previewPair.controllerId);
- }
- splitManager.reconcile(nextLayout.contents);
- restorePreviewPairs(splitManager, nextLayout.previewPairs);
- });
+ splitManager.reconcile(nextContents);
} finally {
reconcilingFromUrl = false;
}
- // Invalid query tuples and unlinked placeholders are rewritten to the
- // manager's canonical representation without adding browser history.
+ // Rewrite invalid URL content without adding browser history.
if (urlLayoutDrift()) syncManagerToUrl({ replace: true });
}
})
diff --git a/apps/web/src/components/app/split-layout/layoutUtils.ts b/apps/web/src/components/app/split-layout/layoutUtils.ts
index f728dad0f5..26b4a8daf8 100644
--- a/apps/web/src/components/app/split-layout/layoutUtils.ts
+++ b/apps/web/src/components/app/split-layout/layoutUtils.ts
@@ -38,6 +38,8 @@ export function decodePairs(segments: string[]): SplitContent[] {
// layoutManager for the matching encode.
pairs.push({ type: 'component', id: 'settings' });
} else if (type === 'component') {
+ // Ignore placeholders left in URLs saved before Preview Pair removal.
+ if (id === 'preview-empty' || id === 'non-member-channel') continue;
pairs.push({ type: 'component', id });
} else {
const resolvedType = resolveBlockAlias(type as BlockName | BlockAlias);
@@ -115,30 +117,14 @@ export function useSplitPanel() {
return useContext(SplitPanelContext);
}
-/**
- * A Preview Pair occupies two slots but behaves as one logical split, and its
- * Viewer is never independently closable.
- */
-export function shouldShowSplitCloseButton(
- manager: SplitManager,
- handle: SplitHandle
-) {
- const logicalSplitCount =
- manager.splits().length - manager.previewPairs().length;
- return logicalSplitCount > 1 && !handle.isViewerSplit();
+/** Whether closing this split leaves another split visible. */
+export function shouldShowSplitCloseButton(manager: SplitManager) {
+ return manager.getVisibleSplitCount() > 1;
}
-/**
- * Whether content may claim focus automatically when it mounts in the current
- * split. Preview Pair Viewers and inline previews stay passive until the user
- * focuses them.
- *
- * This is intentionally a snapshot: dissolving a Preview Pair later must not
- * trigger delayed autofocus in content that is already mounted.
- */
+/** Inline previews stay passive until the user focuses them. */
export function useCanAutofocusSplitContent() {
- const panel = useSplitPanel();
- return !panel?.handle.isViewerSplit() && !panel?.isInlinePreview;
+ return !useSplitPanel()?.isInlinePreview;
}
/**
diff --git a/apps/web/src/components/app/split-layout/previewController.ts b/apps/web/src/components/app/split-layout/previewController.ts
deleted file mode 100644
index 0681d621c4..0000000000
--- a/apps/web/src/components/app/split-layout/previewController.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-import { isListViewID, LIST_VIEW_ID } from '@app/constants/list-views';
-import type { SplitContent, SplitContentType } from './layoutManager';
-
-type PreviewControllerWidth = {
- preferredPx: number;
- /** Optional viewport-relative ceiling, where 0.75 corresponds to 75vw. */
- maxViewportFraction?: number;
-};
-
-/** Default automatic-redistribution width for preview controllers. */
-const DEFAULT_PREVIEW_CONTROLLER_WIDTH: PreviewControllerWidth = {
- preferredPx: 440,
-};
-
-/** Copy for a controller's empty-Viewer placeholder (`preview-empty`). */
-export type PreviewEmptyState = {
- title: string;
- description: string;
-};
-
-type PreviewControllerContentConfig = {
- type: SplitContentType;
- /** Omit to match every block with this content type. */
- id?: string;
- redistributionWidth?: PreviewControllerWidth;
- /** Overrides the generic "No content selected" placeholder copy. */
- emptyState?: PreviewEmptyState;
-};
-
-/** Non-list additions and exact-content overrides for preview controllers. */
-const PREVIEW_CONTROLLER_CONTENT_CONFIG: readonly PreviewControllerContentConfig[] =
- [
- {
- type: 'project',
- },
- {
- type: 'component',
- id: 'getting-started',
- emptyState: {
- title: 'Welcome to Macro',
- description: 'Select an item from the list to get started.',
- },
- },
- {
- type: 'component',
- id: LIST_VIEW_ID.inbox,
- redistributionWidth: { preferredPx: 360 },
- },
- {
- type: 'component',
- id: LIST_VIEW_ID.channels,
- redistributionWidth: { preferredPx: 300 },
- },
- {
- type: 'component',
- id: LIST_VIEW_ID.mail,
- redistributionWidth: { preferredPx: 800, maxViewportFraction: 0.6 },
- },
- {
- type: 'component',
- id: LIST_VIEW_ID.companies,
- redistributionWidth: {
- preferredPx: 880,
- maxViewportFraction: 0.6,
- },
- },
- ];
-
-function previewControllerConfig(content: SplitContent) {
- return PREVIEW_CONTROLLER_CONTENT_CONFIG.find(
- (candidate) =>
- candidate.type === content.type &&
- (candidate.id === undefined || candidate.id === content.id)
- );
-}
-
-export function isPreviewControllerContent(content: SplitContent): boolean {
- return (
- (content.type === 'component' && isListViewID(content.id)) ||
- previewControllerConfig(content) !== undefined
- );
-}
-
-/** Custom empty-Viewer copy for a controller's content, if configured. */
-export function previewEmptyStateForContent(
- content: SplitContent
-): PreviewEmptyState | undefined {
- return previewControllerConfig(content)?.emptyState;
-}
-
-export function previewControllerWidthForContent(
- content: SplitContent,
- viewportWidth?: number
-): number | undefined {
- if (!isPreviewControllerContent(content)) return undefined;
- const config = previewControllerConfig(content);
- const width = config?.redistributionWidth ?? DEFAULT_PREVIEW_CONTROLLER_WIDTH;
- const viewportMax =
- width.maxViewportFraction !== undefined &&
- viewportWidth !== undefined &&
- viewportWidth > 0
- ? viewportWidth * width.maxViewportFraction
- : Infinity;
- return Math.min(width.preferredPx, viewportMax);
-}
diff --git a/apps/web/src/components/app/split-layout/previewPersistence.ts b/apps/web/src/components/app/split-layout/previewPersistence.ts
deleted file mode 100644
index aece79a491..0000000000
--- a/apps/web/src/components/app/split-layout/previewPersistence.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-import { LIST_VIEW_ID } from '@app/constants/list-views';
-import type { SplitContent } from './layoutManager';
-import { decodePairs } from './layoutUtils';
-import { isPreviewControllerContent } from './previewController';
-
-/** Query parameter carrying Controller/Viewer Preview Pairs. */
-export const PREVIEW_QUERY_PARAM = 'preview';
-
-/** A Preview Pair keyed by its Controller's stable URL-order index. */
-export type PreviewPairUrlEntry = {
- controllerIndex: number;
-};
-
-/** URL content plus Preview Pairs restored from its query string. */
-export type RestorablePreviewLayout = {
- contents: SplitContent[];
- previewPairs: PreviewPairUrlEntry[];
-};
-
-export type PreviewQueryValue = string | string[] | undefined;
-
-function isPreviewPairUrlEntry(
- value: PreviewPairUrlEntry
-): value is PreviewPairUrlEntry {
- return Number.isInteger(value.controllerIndex) && value.controllerIndex >= 0;
-}
-
-function parsePreviewPairs(value: PreviewQueryValue): PreviewPairUrlEntry[] {
- if (typeof value !== 'string' || value.length === 0) return [];
-
- return value.split('_').flatMap((tuple): PreviewPairUrlEntry[] => {
- if (!/^\d+$/.test(tuple)) return [];
-
- const entry: PreviewPairUrlEntry = {
- controllerIndex: Number(tuple),
- };
- return isPreviewPairUrlEntry(entry) ? [entry] : [];
- });
-}
-
-/** Serialize Preview Pairs into their canonical compact query value. */
-export function serializePreviewPairs(
- previewPairs: readonly PreviewPairUrlEntry[]
-): string | undefined {
- const value = previewPairs
- .filter(isPreviewPairUrlEntry)
- .toSorted((a, b) => a.controllerIndex - b.controllerIndex)
- .map(({ controllerIndex }) => String(controllerIndex))
- .join('_');
- return value || undefined;
-}
-
-/**
- * Remap a preview query value for a layout whose split at `removedSplitIndex`
- * (URL pair order) is being removed. A Preview Pair whose Controller or Viewer
- * was the removed split is dropped; Controller indices past it shift down by
- * one so the remaining pairs keep pointing at the same splits. Returns the
- * serialized value, or `undefined` when no pairs survive.
- */
-export function remapPreviewQueryForRemovedSplit(
- previewQuery: PreviewQueryValue,
- removedSplitIndex: number
-): string | undefined {
- const remapped = parsePreviewPairs(previewQuery).flatMap(
- (previewPair): PreviewPairUrlEntry[] => {
- const viewerIndex = previewPair.controllerIndex + 1;
- if (
- previewPair.controllerIndex === removedSplitIndex ||
- viewerIndex === removedSplitIndex
- ) {
- return [];
- }
- return [
- previewPair.controllerIndex > removedSplitIndex
- ? { controllerIndex: previewPair.controllerIndex - 1 }
- : previewPair,
- ];
- }
- );
- return serializePreviewPairs(remapped);
-}
-
-function isPreviewEmpty(content: SplitContent): boolean {
- return content.type === 'component' && content.id === 'preview-empty';
-}
-
-function validPreviewPairsForContents(
- contents: readonly SplitContent[],
- previewPairs: readonly PreviewPairUrlEntry[]
-): PreviewPairUrlEntry[] {
- const claimedIndices = new Set<number>();
- const valid: PreviewPairUrlEntry[] = [];
-
- for (const previewPair of previewPairs) {
- const viewerIndex = previewPair.controllerIndex + 1;
- const controller = contents[previewPair.controllerIndex];
- const viewer = contents[viewerIndex];
- if (!controller || !viewer) continue;
- // Only the Controller's content type is constrained — a Viewer may itself
- // be controller-eligible (e.g. a Project controlling another Project),
- // matching the runtime's canLinkPreviewPair. Double-role assignment is
- // prevented by claimedIndices below.
- if (!isPreviewControllerContent(controller)) {
- continue;
- }
- if (
- claimedIndices.has(previewPair.controllerIndex) ||
- claimedIndices.has(viewerIndex)
- ) {
- continue;
- }
- claimedIndices.add(previewPair.controllerIndex);
- claimedIndices.add(viewerIndex);
- valid.push(previewPair);
- }
-
- return valid.sort((a, b) => a.controllerIndex - b.controllerIndex);
-}
-
-/**
- * Decode a URL layout and restore Preview Pairs declared by its query string.
- * Unlinked `preview-empty` entries are removed so the internal placeholder can
- * never load as an independent split.
- */
-export function loadRestorablePreviewLayout(
- segments: readonly string[],
- previewQuery: PreviewQueryValue,
- options: { allowPreviewPairs?: boolean } = {}
-): RestorablePreviewLayout {
- const decoded = decodePairs([...segments]);
- const queryPreviewPairs =
- options.allowPreviewPairs === false ? [] : parsePreviewPairs(previewQuery);
- const validPreviewPairs = validPreviewPairsForContents(
- decoded,
- queryPreviewPairs
- );
- const linkedViewerIndices = new Set(
- validPreviewPairs.map((previewPair) => previewPair.controllerIndex + 1)
- );
-
- const keptContents: SplitContent[] = [];
- const remappedIndices = new Map<number, number>();
- decoded.forEach((content, index) => {
- if (isPreviewEmpty(content) && !linkedViewerIndices.has(index)) return;
- remappedIndices.set(index, keptContents.length);
- keptContents.push(content);
- });
-
- if (keptContents.length === 0) {
- return {
- contents: [{ type: 'component', id: LIST_VIEW_ID.inbox }],
- previewPairs: [],
- };
- }
-
- return {
- contents: keptContents,
- previewPairs: validPreviewPairs.flatMap(
- (previewPair): PreviewPairUrlEntry[] => {
- const controllerIndex = remappedIndices.get(
- previewPair.controllerIndex
- );
- const viewerIndex = remappedIndices.get(
- previewPair.controllerIndex + 1
- );
- return controllerIndex === undefined ||
- viewerIndex !== controllerIndex + 1
- ? []
- : [{ ...previewPair, controllerIndex }];
- }
- ),
- };
-}
diff --git a/apps/web/src/components/app/split-layout/registerSplitHotkeys.ts b/apps/web/src/components/app/split-layout/registerSplitHotkeys.ts
index a26ad5f419..69cfd8832d 100644
--- a/apps/web/src/components/app/split-layout/registerSplitHotkeys.ts
+++ b/apps/web/src/components/app/split-layout/registerSplitHotkeys.ts
@@ -18,7 +18,6 @@ export function registerSplitHotkeys(args: {
splitName: () => string;
getSplitCount: () => number;
isNotUnifiedList: () => boolean;
- isViewerSplit: () => boolean;
}) {
const {
splitHotkeyScope,
@@ -31,14 +30,12 @@ export function registerSplitHotkeys(args: {
splitName,
getSplitCount,
isNotUnifiedList,
- isViewerSplit: isPreviewSplit,
goToList,
} = args;
registerHotkey({
scopeId: splitHotkeyScope,
hotkey: ['cmd+escape', 'opt+escape'],
- condition: () =>
- !isPreviewSplit() && (isNotUnifiedList() || getSplitCount() > 1),
+ condition: () => isNotUnifiedList() || getSplitCount() > 1,
description: () => (isNotUnifiedList() ? 'Back to list' : 'Close split'),
keyDownHandler: () => {
if (isNotUnifiedList()) {
diff --git a/apps/web/src/components/app/split-layout/splitContentSizing.ts b/apps/web/src/components/app/split-layout/splitContentSizing.ts
index 3611906ae7..2e0d6c7693 100644
--- a/apps/web/src/components/app/split-layout/splitContentSizing.ts
+++ b/apps/web/src/components/app/split-layout/splitContentSizing.ts
@@ -1,43 +1,2 @@
-import { isListViewID } from '@app/constants/list-views';
-import type { SplitContent } from './layoutManager';
-
-/** Default hard minimum width for split content without an override. */
+/** Default hard minimum width for split content. */
export const DEFAULT_SPLIT_MIN_WIDTH = 400;
-
-type SplitContentSizingContext = {
- isPreviewController: boolean;
-};
-
-type SplitContentSizingConfig = {
- matches: (
- content: SplitContent,
- context: SplitContentSizingContext
- ) => boolean;
- minWidthPx: number;
-};
-
-/**
- * Declarative hard-size overrides for categories of split content. Earlier
- * rules take precedence, allowing exact-content exceptions before broad rules.
- */
-const SPLIT_CONTENT_SIZING_CONFIG: readonly SplitContentSizingConfig[] = [
- {
- matches: (content, context) =>
- context.isPreviewController &&
- content.type === 'component' &&
- isListViewID(content.id),
- // NOTE: 300 is as low as we can go without rethinking the layout.
- minWidthPx: 300,
- },
-];
-
-/** Resolve the hard minimum width for a split from its mounted content. */
-export function splitMinWidthForContent(
- content: SplitContent,
- context: SplitContentSizingContext
-): number {
- const config = SPLIT_CONTENT_SIZING_CONFIG.find((candidate) =>
- candidate.matches(content, context)
- );
- return config?.minWidthPx ?? DEFAULT_SPLIT_MIN_WIDTH;
-}
diff --git a/apps/web/src/components/app/split-layout/splitFocusTracker.ts b/apps/web/src/components/app/split-layout/splitFocusTracker.ts
index d0fc0a3530..daa372d431 100644
--- a/apps/web/src/components/app/split-layout/splitFocusTracker.ts
+++ b/apps/web/src/components/app/split-layout/splitFocusTracker.ts
@@ -118,14 +118,7 @@ export function createSplitFocusTracker(props: {
switch (event.type) {
case SplitEvent.Insert: {
if (event.activate === false) break;
- // A fresh load replays its last Insert event once this tracker
- // mounts, and the last URL split is often a restored Preview Pair's
- // Viewer. The Viewer displays content passively while its Controller
- // owns the keyboard (restorePreviewPair already returned activation
- // to it), so initial focus follows the Controller too.
- const splitId =
- props.splitManager.controllerOf(event.splitId) ?? event.splitId;
- focusSplitById(splitId);
+ focusSplitById(event.splitId);
break;
}
case SplitEvent.Remove: {
diff --git a/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx b/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx
index 4804f5c83d..647578f400 100644
--- a/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx
+++ b/apps/web/src/components/app/split-layout/tests/activity-registration.test.tsx
@@ -51,10 +51,6 @@ vi.mock('@app/features/inbox-view/inbox-view', () => ({}));
vi.mock('@app/features/next-soup/filters/filter-store', () => ({}));
vi.mock('@app/features/next-soup/filters/filter-store/query-store', () => ({}));
vi.mock('@app/features/next-soup/sidebar/soup-filter-presets', () => ({}));
-vi.mock(
- '@app/features/next-soup/soup-view/non-member-channel-preview',
- () => ({})
-);
vi.mock('@app/features/next-soup/soup-view/soup-view', () => ({}));
vi.mock('@app/features/next-soup/use-recent-view-flag', () => ({}));
vi.mock('@app/features/reminders/ReminderEditorSplit', () => ({}));
@@ -70,7 +66,6 @@ vi.mock('@core/context/user', () => ({}));
vi.mock('@core/mobile/isTouchDevice', () => ({}));
vi.mock('@queries/agent-schedule/entities', () => ({}));
vi.mock('@ui', () => ({}));
-vi.mock('../previewController', () => ({}));
beforeEach(() => {
vi.clearAllMocks();
diff --git a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
index 74d3658ed3..9cf131c22d 100644
--- a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
@@ -16,8 +16,8 @@ import {
type SplitContent,
SplitEvent,
} from '../layoutManager';
+import { shouldShowSplitCloseButton } from '../layoutUtils';
import { createMobileSwipeLayout } from '../mobile/createMobileSwipeLayout';
-import { previewControllerWidthForContent } from '../previewController';
vi.mock('@core/component/Toast/Toast', () => ({
toast: { alert: vi.fn() },
@@ -239,6 +239,33 @@ describe('layoutManager', () => {
});
});
+ it('navigates and closes adjacent list and detail splits independently', () => {
+ createRoot((dispose) => {
+ const manager = createSplitLayout(createMockOrchestrator(), [
+ { type: 'component', id: 'inbox' },
+ { type: 'md', id: 'detail' },
+ ]);
+ const [list, detail] = manager.splits();
+ const listHandle = manager.getSplit(list.id)!;
+ const detailHandle = manager.getSplit(detail.id)!;
+
+ manager.openWithSplit(
+ { type: 'email', id: 'thread' },
+ { handle: listHandle }
+ );
+ expect(listHandle.content()).toEqual({ type: 'email', id: 'thread' });
+ expect(detailHandle.content()).toEqual({ type: 'md', id: 'detail' });
+ expect(manager.splits()).toHaveLength(2);
+
+ listHandle.goBack();
+ expect(listHandle.content()).toEqual({ type: 'component', id: 'inbox' });
+ expect(detailHandle.content()).toEqual({ type: 'md', id: 'detail' });
+ listHandle.close();
+ expect(manager.splits().map((split) => split.id)).toEqual([detail.id]);
+ dispose();
+ });
+ });
+
describe('swapSplit', () => {
it('swaps adjacent splits and delegates the panel reorder to Resize', () => {
createRoot((dispose) => {
@@ -264,31 +291,6 @@ describe('layoutManager', () => {
dispose();
});
});
-
- it('swaps a preview pair as a unit', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- { type: 'component', id: 'calendar' },
- ]);
- const controllerId = manager.splits()[0]!.id;
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
- const calendarId = manager.splits()[2]!.id;
-
- manager.swapSplit(viewerId, 'right');
-
- expect(manager.splits().map((split) => split.id)).toEqual([
- calendarId,
- controllerId,
- viewerId,
- ]);
- expect(manager.canSwapSplit(viewerId, 'right')).toBe(false);
- expect(manager.canSwapSplit(viewerId, 'left')).toBe(true);
-
- dispose();
- });
- });
});
describe('reconciler', () => {
@@ -984,13 +986,16 @@ describe('layoutManager', () => {
]);
const [fg, bg] = manager.splits();
+ expect(shouldShowSplitCloseButton(manager)).toBe(true);
manager.activateSplit(fg.id);
manager.setExclusionFilter((split) => split.id === bg.id);
+ expect(shouldShowSplitCloseButton(manager)).toBe(false);
manager.activateSplit(bg.id);
expect(manager.activeSplitId()).toBe(fg.id);
manager.setExclusionFilter(undefined);
+ expect(shouldShowSplitCloseButton(manager)).toBe(true);
manager.activateSplit(bg.id);
expect(manager.activeSplitId()).toBe(bg.id);
@@ -1031,1015 +1036,6 @@ describe('layoutManager', () => {
});
});
- describe('preview mode', () => {
- const setup = () => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- ]);
- const controllerId = manager.splits()[0].id;
- manager.activateSplit(controllerId);
- return { manager, controllerId };
- };
-
- it('eagerly opens an empty viewer right of the controller without activating it', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
-
- expect(manager.previewControllerWidth(controllerId)).toBe(360);
- expect(manager.splits()).toHaveLength(2);
- const viewerId = manager.splits()[1].id;
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.controllerOf(viewerId)).toBe(controllerId);
- expect(manager.getSplit(controllerId)?.isControllerSplit()).toBe(true);
- expect(manager.getSplit(controllerId)?.isViewerSplit()).toBe(false);
- expect(manager.getSplit(viewerId)?.isControllerSplit()).toBe(false);
- expect(manager.getSplit(viewerId)?.isViewerSplit()).toBe(true);
- expect(manager.previewPairs()).toEqual([{ controllerId, viewerId }]);
- expect(manager.splits()[1].content).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
- expect(manager.events()).toMatchObject({
- type: SplitEvent.Insert,
- splitId: viewerId,
- activate: false,
- });
- expect(manager.activeSplitId()).toBe(controllerId);
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(2);
- expect(manager.splits()[1].content).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- dispose();
- });
- });
-
- it('resets the viewer to its placeholder without stacking history', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()[1].content).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- manager.getSplit(controllerId)?.resetPreview();
-
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.splits()).toHaveLength(2);
- expect(manager.splits()[1].content).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
- // Selection state was merge-replaced both ways, so the stale entity
- // does not linger as a back entry.
- expect(manager.getSplit(viewerId)?.canGoBack()).toBe(false);
-
- dispose();
- });
- });
-
- it('resets the viewer when the controller navigates backward or forward', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- const controller = manager.getSplit(controllerId)!;
- controller.replace({
- next: { type: 'component', id: 'channels' },
- });
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: controller }
- );
- controller.goBack();
-
- expect(controller.content()).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
- expect(manager.getSplit(viewerId)?.content()).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- { referredFrom: null, handle: controller }
- );
- controller.goForward();
-
- expect(controller.content()).toMatchObject({
- type: 'component',
- id: 'channels',
- });
- expect(manager.getSplit(viewerId)?.content()).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
-
- dispose();
- });
- });
-
- it('reset is a no-op without a viewer or when already on the placeholder', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
-
- manager.resetPreviewMode(controllerId);
- expect(manager.splits()).toHaveLength(1);
-
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
- manager.resetPreviewMode(controllerId);
-
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.splits()[1].content).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
-
- dispose();
- });
- });
-
- it('uses the configured controller width for Email Soup', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'mail' },
- ]);
- const controllerId = manager.splits()[0].id;
-
- manager.engagePreviewMode(controllerId);
-
- expect(manager.previewControllerWidth(controllerId)).toBe(800);
-
- dispose();
- });
- });
-
- it('allows a Project block to control unless it is already a Viewer', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'project', id: 'project-controller' },
- ]);
- const controller = manager.getSplit(manager.splits()[0].id)!;
-
- expect(controller.canEngagePreview()).toBe(true);
- controller.engagePreview();
-
- const viewerId = controller.viewerId()!;
- const viewer = manager.getSplit(viewerId)!;
- manager.openWithSplit(
- { type: 'project', id: 'project-viewer' },
- { referredFrom: null, handle: controller }
- );
-
- expect(controller.content()).toMatchObject({
- type: 'project',
- id: 'project-controller',
- });
- expect(viewer.content()).toMatchObject({
- type: 'project',
- id: 'project-viewer',
- });
- expect(manager.viewerOf(controller.id)).toBe(viewer.id);
- expect(viewer.isViewerSplit()).toBe(true);
- expect(viewer.canEngagePreview()).toBe(false);
-
- viewer.engagePreview();
- expect(manager.previewPairs()).toEqual([
- { controllerId: controller.id, viewerId: viewer.id },
- ]);
-
- dispose();
- });
- });
-
- it('uses the configured Companies controller width', () => {
- createRoot((dispose) => {
- const content = { type: 'component' as const, id: 'companies' };
- const manager = createSplitLayout(createMockOrchestrator(), [content]);
- const controllerId = manager.splits()[0].id;
-
- manager.engagePreviewMode(controllerId);
-
- for (const viewportWidth of [1000, 1600]) {
- expect(
- manager.previewControllerWidth(controllerId, viewportWidth)
- ).toBe(previewControllerWidthForContent(content, viewportWidth));
- }
-
- dispose();
- });
- });
-
- it('creates a distinct empty viewer for each preview controller', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- { type: 'component', id: 'channels' },
- ]);
- const [firstController, secondController] = manager.splits();
-
- manager.engagePreviewMode(firstController.id);
- const firstViewerId = manager.viewerOf(firstController.id)!;
- manager.engagePreviewMode(secondController.id);
- const secondViewerId = manager.viewerOf(secondController.id)!;
-
- expect(secondViewerId).toBeDefined();
- expect(secondViewerId).not.toBe(firstViewerId);
- expect(manager.splits().map((split) => split.id)).toEqual([
- firstController.id,
- firstViewerId,
- secondController.id,
- secondViewerId,
- ]);
-
- dispose();
- });
- });
-
- it('adopts an unclaimed adjacent placeholder split instead of duplicating it', () => {
- createRoot((dispose) => {
- // An existing unclaimed placeholder is adopted rather than duplicated,
- // leaving the placeholder (last initial split) active beforehand.
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- { type: 'component', id: 'preview-empty' },
- ]);
- const controllerId = manager.splits()[0].id;
- const placeholderId = manager.splits()[1].id;
- expect(manager.activeSplitId()).toBe(placeholderId);
-
- manager.engagePreviewMode(controllerId);
-
- expect(manager.splits()).toHaveLength(2);
- expect(manager.viewerOf(controllerId)).toBe(placeholderId);
- // The controller takes over activation from its adopted viewer so
- // active-split-targeted navigations redirect through it.
- expect(manager.activeSplitId()).toBe(controllerId);
-
- dispose();
- });
- });
-
- it('restores a persisted Preview Pair onto existing adjacent splits', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- { type: 'md', id: 'doc-1' },
- ]);
- const controllerId = manager.splits()[0].id;
- const viewerId = manager.splits()[1].id;
-
- expect(manager.restorePreviewPair(controllerId, viewerId)).toBe(true);
- expect(manager.splits()).toHaveLength(2);
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.controllerOf(viewerId)).toBe(controllerId);
- expect(manager.previewControllerWidth(controllerId)).toBe(360);
- expect(manager.activeSplitId()).toBe(controllerId);
-
- dispose();
- });
- });
-
- it('rejects a persisted Preview Pair that is no longer adjacent', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'component', id: 'inbox' },
- { type: 'md', id: 'between' },
- { type: 'md', id: 'viewer' },
- ]);
- const controllerId = manager.splits()[0].id;
- const viewerId = manager.splits()[2].id;
-
- expect(manager.restorePreviewPair(controllerId, viewerId)).toBe(false);
- expect(manager.previewPairs()).toEqual([]);
-
- dispose();
- });
- });
-
- it('unlinks a Preview Pair when a split is inserted between it', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- const inserted = manager.createNewSplit({
- content: { type: 'md', id: 'between' },
- referredFrom: null,
- insertIndex: 1,
- });
- if (!inserted) throw new Error('Expected content to open');
-
- expect(manager.splits().map((split) => split.id)).toEqual([
- controllerId,
- inserted.id,
- viewerId,
- ]);
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.controllerOf(viewerId)).toBeUndefined();
- expect(manager.previewPairs()).toEqual([]);
-
- dispose();
- });
- });
-
- it('unlinks a Preview Pair when reconciliation separates it', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'viewer' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
- const between = manager.createNewSplit({
- content: { type: 'md', id: 'between' },
- referredFrom: null,
- });
- if (!between) throw new Error('Expected content to open');
-
- manager.reconcile([
- { type: 'component', id: 'inbox' },
- { type: 'md', id: 'between' },
- { type: 'md', id: 'viewer' },
- ]);
-
- expect(manager.splits().map((split) => split.id)).toEqual([
- controllerId,
- between.id,
- viewerId,
- ]);
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.controllerOf(viewerId)).toBeUndefined();
- expect(manager.previewPairs()).toEqual([]);
-
- dispose();
- });
- });
-
- it('controller-originated navigation never grows the preview history', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
- const viewer = manager.getSplit(viewerId)!;
-
- // Selections from the controller replace the preview's current entry.
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(2);
- expect(viewer.content()).toMatchObject({ type: 'md', id: 'doc-2' });
- expect(viewer.history()).toHaveLength(1);
- expect(viewer.canGoBack()).toBe(false);
- expect(manager.activeSplitId()).toBe(controllerId);
-
- // The preview's own navigation stacks up as usual...
- manager.openWithSplit(
- { type: 'md', id: 'doc-3' },
- { referredFrom: null, handle: manager.getSplit(viewerId) }
- );
- expect(viewer.history()).toHaveLength(2);
-
- // ...and back returns to the last controller selection.
- viewer.goBack();
- expect(viewer.content()).toMatchObject({ type: 'md', id: 'doc-2' });
-
- dispose();
- });
- });
-
- it('routes Controller replacements to the Viewer, honoring new-split intent', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- // A replacement from the Controller lands in the Viewer.
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(2);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
- expect(manager.activeSplitId()).toBe(controllerId);
-
- // Explicit new-split intent opens a real new split; the Preview Pair
- // stays.
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- {
- referredFrom: null,
- preferNewSplit: true,
- handle: manager.getSplit(controllerId),
- }
- );
- expect(manager.splits()).toHaveLength(3);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
-
- dispose();
- });
- });
-
- it('replacePreview dissolves the Preview Pair and opens in its place', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- // Something is being previewed...
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(2);
-
- // ...and opening another row for real takes the whole pair's place.
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- {
- referredFrom: null,
- replacePreview: true,
- handle: manager.getSplit(controllerId),
- }
- );
-
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(viewerId)).toBeUndefined();
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.getSplit(controllerId)!.isControllerSplit()).toBe(false);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-2',
- });
- expect(manager.activeSplitId()).toBe(controllerId);
-
- // The list it replaced is one step back.
- manager.getSplit(controllerId)!.goBack();
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
-
- dispose();
- });
- });
-
- it('replacePreview wins over new-split intent even with room to spare', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- {
- referredFrom: null,
- replacePreview: true,
- preferNewSplit: true,
- handle: manager.getSplit(controllerId),
- }
- );
-
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(viewerId)).toBeUndefined();
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- dispose();
- });
- });
-
- it('replacePreview promotes the previewed row itself without duplicating it', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
-
- // The Viewer holds this content; closing it with the pair leaves the
- // Controller free to take it, rather than short-circuiting into the
- // split that is about to disappear.
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- {
- referredFrom: null,
- replacePreview: true,
- handle: manager.getSplit(controllerId),
- }
- );
-
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(viewerId)).toBeUndefined();
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- dispose();
- });
- });
-
- it('promotes the previewed content into its own split, resetting the Viewer', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- // New-split intent for the row currently being previewed: the Viewer's
- // copy is that preview, so it must not short-circuit into "already
- // open" — the content gets a real split and the preview resets.
- const created = manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- {
- referredFrom: null,
- preferNewSplit: true,
- handle: manager.getSplit(controllerId),
- }
- );
-
- expect(manager.splits()).toHaveLength(3);
- expect(created?.id).not.toBe(viewerId);
- expect(created?.content()).toMatchObject({ type: 'md', id: 'doc-1' });
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
-
- dispose();
- });
- });
-
- it('leaves the preview in place when a promotion cannot fit', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- manager.setResizeContext({
- canFit: () => false,
- } as unknown as ResizeZoneCtx);
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- {
- referredFrom: null,
- preferNewSplit: true,
- handle: manager.getSplit(controllerId),
- }
- );
-
- expect(manager.splits()).toHaveLength(2);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
-
- dispose();
- });
- });
-
- it('honors handle-less new-split intent without dissolving the Preview Pair', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- const newSplit = manager.openWithSplit(
- { type: 'component', id: 'inbox' },
- {
- referredFrom: 'hotkey',
- allowDuplicate: true,
- preferNewSplit: true,
- }
- );
-
- expect(manager.splits()).toHaveLength(3);
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
- expect(manager.controllerOf(viewerId)).toBe(controllerId);
- expect(newSplit?.content()).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
- expect(manager.activeSplitId()).toBe(newSplit?.id);
-
- dispose();
- });
- });
-
- it('new-split intent falls back to the Viewer when the layout is full', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
- manager.setResizeContext({
- canFit: () => false,
- } as unknown as ResizeZoneCtx);
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- {
- referredFrom: null,
- preferNewSplit: true,
- handle: manager.getSplit(controllerId),
- }
- );
- // The fallback replaces the Viewer — never the Controller.
- expect(manager.splits()).toHaveLength(2);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
-
- dispose();
- });
- });
-
- it('external (handle-less) navigation dissolves the Preview Pair', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- expect(manager.splits()).toHaveLength(2);
-
- // Sidebar-style soup view: content replaces the controller, the
- // Viewer closes.
- manager.openWithSplit(
- { type: 'component', id: 'channels' },
- { referredFrom: null }
- );
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'component',
- id: 'channels',
- });
- expect(manager.viewerOf(controllerId)).toBeUndefined();
-
- // Command-menu-style entity selection dissolves the Preview Pair the
- // same way.
- manager.engagePreviewMode(controllerId);
- expect(manager.splits()).toHaveLength(2);
- manager.openWithSplit(
- { type: 'md', id: 'doc-k' },
- { referredFrom: null }
- );
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-k',
- });
- expect(manager.viewerOf(controllerId)).toBeUndefined();
-
- dispose();
- });
- });
-
- it('returns a duplicate split without activating it', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.createNewSplit({
- content: { type: 'email', id: 'doc-open-elsewhere' },
- referredFrom: null,
- });
- manager.activateSplit(controllerId);
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- const result = manager.openWithSplit(
- { type: 'email', id: 'doc-open-elsewhere' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
-
- expect(manager.splits()).toHaveLength(3);
- expect(result?.content()).toMatchObject({
- type: 'email',
- id: 'doc-open-elsewhere',
- });
- expect(manager.activeSplitId()).toBe(controllerId);
- // The eager viewer keeps its placeholder; nothing was opened into it.
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'component',
- id: 'preview-empty',
- });
-
- dispose();
- });
- });
-
- it('disengages the Controller when the Viewer is closed', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.removeSplit(viewerId);
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.previewPairs()).toEqual([]);
-
- // Subsequent navigation replaces the controller normally.
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-2',
- });
-
- dispose();
- });
- });
-
- it('disengages when the Controller navigates away from a list view', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- expect(manager.splits()).toHaveLength(2);
-
- // The Viewer still shows the placeholder: it closes along with the
- // Preview Pair.
- manager.getSplit(controllerId)!.replace({
- next: { type: 'md', id: 'doc-x' },
- });
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.splits()).toHaveLength(1);
-
- dispose();
- });
- });
-
- it('closes a content-bearing viewer when the controller leaves its list view', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.getSplit(controllerId)!.replace({
- next: { type: 'md', id: 'doc-x' },
- });
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(viewerId)).toBeUndefined();
-
- dispose();
- });
- });
-
- it('closes the viewer when the controller closes', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.getSplit(controllerId)!.close();
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.previewPairs()).toEqual([]);
- expect(manager.getSplit(controllerId)).toBeUndefined();
- expect(manager.getSplit(viewerId)).toBeUndefined();
- expect(manager.splits()).toHaveLength(1);
- expect(manager.splits()[0].content).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
-
- dispose();
- });
- });
-
- it('disengages when reconcile drops the viewer', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.viewerOf(controllerId)).toBeDefined();
-
- manager.reconcile([{ type: 'component', id: 'inbox' }]);
-
- expect(manager.splits()).toHaveLength(1);
- expect(manager.splits()[0].id).toBe(controllerId);
- expect(manager.viewerOf(controllerId)).toBeUndefined();
-
- dispose();
- });
- });
-
- it('disengage closes the viewer and restores normal replace behavior', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.disengagePreviewMode(controllerId);
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.previewControllerWidth(controllerId)).toBeUndefined();
- expect(manager.getSplit(viewerId)).toBeUndefined();
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-2',
- });
-
- dispose();
- });
- });
-
- it('can unlink the Preview Pair without closing splits for URL reconstruction', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- const viewerId = manager.viewerOf(controllerId)!;
-
- manager.unlinkPreviewPair(controllerId);
-
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.previewControllerWidth(controllerId)).toBeUndefined();
- expect(manager.getSplit(controllerId)).toBeDefined();
- expect(manager.getSplit(viewerId)).toBeDefined();
-
- dispose();
- });
- });
-
- it('leaves openWithSplit untouched when no split is engaged', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
-
- manager.openWithSplit(
- { type: 'md', id: 'doc-1' },
- { referredFrom: null, handle: manager.getSplit(controllerId) }
- );
- expect(manager.splits()).toHaveLength(1);
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-1',
- });
- expect(manager.activeSplitId()).toBe(controllerId);
-
- dispose();
- });
- });
-
- it('the Viewer navigates like a normal split', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.engagePreviewMode(controllerId);
- const viewerId = manager.viewerOf(controllerId)!;
-
- // A replacement from the Viewer replaces the Viewer.
- manager.openWithSplit(
- { type: 'md', id: 'doc-2' },
- { referredFrom: null, handle: manager.getSplit(viewerId) }
- );
- expect(manager.splits()).toHaveLength(2);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-2',
- });
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
-
- // New-split intent from the Viewer opens a real new split;
- // the Preview Pair stays intact and the Controller is untouched.
- manager.openWithSplit(
- { type: 'md', id: 'doc-3' },
- {
- referredFrom: null,
- preferNewSplit: true,
- handle: manager.getSplit(viewerId),
- }
- );
- expect(manager.splits()).toHaveLength(3);
- expect(manager.getSplit(viewerId)!.content()).toMatchObject({
- type: 'md',
- id: 'doc-2',
- });
- expect(manager.getSplit(controllerId)!.content()).toMatchObject({
- type: 'component',
- id: 'inbox',
- });
- expect(manager.viewerOf(controllerId)).toBe(viewerId);
-
- dispose();
- });
- });
-
- it('cannot engage without room for a Viewer', () => {
- createRoot((dispose) => {
- const { manager, controllerId } = setup();
- manager.setResizeContext({
- canFit: () => false,
- } as unknown as ResizeZoneCtx);
-
- expect(manager.canEngagePreview(controllerId)).toBe(false);
- manager.engagePreviewMode(controllerId);
-
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.splits()).toHaveLength(1);
-
- dispose();
- });
- });
-
- it('cannot engage ineligible content as a preview controller', () => {
- createRoot((dispose) => {
- const manager = createSplitLayout(createMockOrchestrator(), [
- { type: 'md', id: 'doc-1' },
- ]);
- const controllerId = manager.splits()[0].id;
-
- expect(manager.canEngagePreview(controllerId)).toBe(false);
- manager.engagePreviewMode(controllerId);
-
- expect(manager.viewerOf(controllerId)).toBeUndefined();
- expect(manager.splits()).toHaveLength(1);
-
- dispose();
- });
- });
- });
-
describe('popover splits', () => {
it('lets an onClose handler decide when a popover finishes closing', () => {
createRoot((dispose) => {
diff --git a/apps/web/src/components/app/split-layout/tests/layoutUrlSync.test.ts b/apps/web/src/components/app/split-layout/tests/layoutUrlSync.test.ts
index 636c8a04ec..f826e5d6c9 100644
--- a/apps/web/src/components/app/split-layout/tests/layoutUrlSync.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/layoutUrlSync.test.ts
@@ -2,14 +2,10 @@ import { agentsRouteId } from '@app/features/agents-view/core/route';
import { createContentInstanceRegistry } from '@core/contentInstanceRegistry';
import type { BlockOrchestrator } from '@core/orchestrator';
import type { Navigator } from '@solidjs/router';
-import { batch, createMemo, createRoot, createSignal } from 'solid-js';
+import { batch, createRoot, createSignal } from 'solid-js';
import { beforeAll, describe, expect, it, vi } from 'vitest';
import { createSplitLayout, type SplitContent } from '../layoutManager';
import { createLayoutUrlSync } from '../layoutUrlSync';
-import {
- loadRestorablePreviewLayout,
- type PreviewQueryValue,
-} from '../previewPersistence';
vi.mock('../componentRegistry', () => ({
resolveComponent: vi.fn((id: string, params: Record<string, string>) => ({
@@ -55,7 +51,6 @@ function createMockOrchestrator(): BlockOrchestrator {
type HarnessOptions = {
managerContent: SplitContent[];
urlSegments: string[];
- previewQuery?: PreviewQueryValue;
search?: string;
hash?: string;
};
@@ -69,36 +64,21 @@ function createHarness(options: HarnessOptions) {
options.managerContent
);
const [pairs, setPairs] = createSignal(options.urlSegments);
- const [previewQuery, setPreviewQuery] = createSignal<PreviewQueryValue>(
- options.previewQuery
- );
const [search, setSearch] = createSignal(options.search ?? '');
- const [hash, setHash] = createSignal(options.hash ?? '');
- const decodedLayout = createMemo(() =>
- loadRestorablePreviewLayout(pairs(), previewQuery())
- );
- createLayoutUrlSync(manager, pairs, previewQuery, decodedLayout, {
+ createLayoutUrlSync(manager, pairs, {
navigate: navigate as Navigator,
search,
- hash,
});
return {
manager,
navigate,
dispose,
- setUrl(
- segments: string[],
- preview: PreviewQueryValue,
- nextSearch = '',
- nextHash = ''
- ) {
+ setUrl(segments: string[], nextSearch = '') {
batch(() => {
setPairs(segments);
- setPreviewQuery(preview);
setSearch(nextSearch);
- setHash(nextHash);
});
},
};
@@ -137,19 +117,19 @@ describe('layout URL synchronization', () => {
expect(harness.navigate).toHaveBeenLastCalledWith('/agents/session-1', {
replace: false,
});
- harness.setUrl(['agents', 'session-1'], undefined);
+ harness.setUrl(['agents', 'session-1']);
await flushUrlSync();
handle.replace({ next: code });
await flushUrlSync();
expect(harness.navigate).toHaveBeenLastCalledWith('/coders/session-2', {
replace: false,
});
- harness.setUrl(['coders', 'session-2'], undefined);
+ harness.setUrl(['coders', 'session-2']);
await flushUrlSync();
- harness.setUrl(['agents', 'session-1'], undefined);
+ harness.setUrl(['agents', 'session-1']);
await flushUrlSync();
expect(harness.manager.splits()[0].content).toEqual(chat);
- harness.setUrl(['coders', 'session-2'], undefined);
+ harness.setUrl(['coders', 'session-2']);
await flushUrlSync();
expect(harness.manager.splits()[0].content).toEqual(code);
harness.dispose();
@@ -205,68 +185,23 @@ describe('layout URL synchronization', () => {
harness.dispose();
});
- it('coalesces preview engagement into one canonical manager-to-URL update', async () => {
+ it('reconciles URL paths without navigating back', async () => {
const harness = createHarness({
managerContent: [{ type: 'component', id: 'inbox' }],
urlSegments: ['component', 'inbox'],
});
-
await flushUrlSync();
harness.navigate.mockClear();
- harness.manager.engagePreviewMode(harness.manager.splits()[0].id);
- await flushUrlSync();
-
- expect(harness.navigate).toHaveBeenCalledTimes(1);
- expect(harness.navigate).toHaveBeenCalledWith(
- `/${harness.manager.getUrlSegments().join('/')}?preview=0`,
- { replace: false }
- );
-
- harness.dispose();
- });
-
- it('preserves unrelated query and hash state for a query-only update', async () => {
- const harness = createHarness({
- managerContent: [
- { type: 'component', id: 'inbox' },
- { type: 'component', id: 'preview-empty' },
- ],
- urlSegments: ['component', 'inbox', 'component', 'preview-empty'],
- search: '?keep=value',
- hash: '#selection',
- });
+ harness.setUrl(['component', 'inbox', 'md', 'doc-1']);
await flushUrlSync();
- harness.navigate.mockClear();
- harness.manager.engagePreviewMode(harness.manager.splits()[0].id);
- await flushUrlSync();
-
- expect(harness.navigate).toHaveBeenCalledWith(
- `/${harness.manager.getUrlSegments().join('/')}?keep=value&preview=0#selection`,
- { replace: false }
- );
- harness.dispose();
- });
-
- it('reconciles URL path and preview state without navigating back', async () => {
- const harness = createHarness({
- managerContent: [{ type: 'component', id: 'inbox' }],
- urlSegments: ['component', 'inbox'],
- });
- await flushUrlSync();
- harness.navigate.mockClear();
-
- harness.setUrl(['component', 'inbox', 'md', 'doc-1'], '0', '?preview=0');
- await flushUrlSync();
-
- const [controller, viewer] = harness.manager.splits();
- expect(controller.content).toMatchObject({
+ const [list, detail] = harness.manager.splits();
+ expect(list.content).toMatchObject({
type: 'component',
id: 'inbox',
});
- expect(viewer.content).toMatchObject({ type: 'md', id: 'doc-1' });
- expect(harness.manager.viewerOf(controller.id)).toBe(viewer.id);
+ expect(detail.content).toMatchObject({ type: 'md', id: 'doc-1' });
expect(harness.navigate).not.toHaveBeenCalled();
harness.dispose();
@@ -288,45 +223,6 @@ describe('layout URL synchronization', () => {
harness.dispose();
});
- it('restores a Preview Pair across a settings clobber round trip', async () => {
- const harness = createHarness({
- managerContent: [{ type: 'component', id: 'mail' }],
- urlSegments: ['component', 'mail'],
- });
- await flushUrlSync();
-
- // Engage preview and give the viewer real content, like opening an item.
- const controllerId = harness.manager.splits()[0].id;
- harness.manager.engagePreviewMode(controllerId);
- const viewerId = harness.manager.viewerOf(controllerId)!;
- harness.manager.getSplit(viewerId)!.replace({
- next: { type: 'md', id: 'doc-1' },
- mergeHistory: true,
- });
- await flushUrlSync();
- harness.setUrl(['component', 'mail', 'md', 'doc-1'], '0', '?preview=0');
- await flushUrlSync();
-
- // Open settings: clobber down to a lone settings split
- // (collapseToSoloSettings), then apply the URL the sync emitted.
- harness.manager.replaceAllSplits({ type: 'component', id: 'settings' });
- await flushUrlSync();
- harness.setUrl(['settings', 'account'], undefined, '');
- await flushUrlSync();
-
- // Close settings: navigate back to the captured return URL.
- harness.setUrl(['component', 'mail', 'md', 'doc-1'], '0', '?preview=0');
- await flushUrlSync();
-
- const [controller, viewer] = harness.manager.splits();
- expect(controller.content).toMatchObject({
- type: 'component',
- id: 'mail',
- });
- expect(viewer.content).toMatchObject({ type: 'md', id: 'doc-1' });
- expect(harness.manager.viewerOf(controller.id)).toBe(viewer.id);
- });
-
it('uses replace navigation and clears location state for replace-caused path changes', async () => {
const harness = createHarness({
managerContent: [{ type: 'component', id: 'inbox' }],
diff --git a/apps/web/src/components/app/split-layout/tests/previewController.test.ts b/apps/web/src/components/app/split-layout/tests/previewController.test.ts
deleted file mode 100644
index b06e9eeff0..0000000000
--- a/apps/web/src/components/app/split-layout/tests/previewController.test.ts
+++ /dev/null
@@ -1,91 +0,0 @@
-import { describe, expect, it } from 'vitest';
-import {
- isPreviewControllerContent,
- previewControllerWidthForContent,
-} from '../previewController';
-import {
- DEFAULT_SPLIT_MIN_WIDTH,
- splitMinWidthForContent,
-} from '../splitContentSizing';
-
-describe('preview controller content', () => {
- it('explicitly recognizes configured content', () => {
- expect(isPreviewControllerContent({ type: 'component', id: 'inbox' })).toBe(
- true
- );
- expect(
- isPreviewControllerContent({ type: 'component', id: 'settings' })
- ).toBe(false);
- expect(isPreviewControllerContent({ type: 'md', id: 'doc-1' })).toBe(false);
- expect(
- isPreviewControllerContent({ type: 'project', id: 'project-1' })
- ).toBe(true);
- });
-
- it('resolves default and content-specific widths from the same config', () => {
- const inboxWidth = previewControllerWidthForContent({
- type: 'component',
- id: 'inbox',
- });
- const channelsWidth = previewControllerWidthForContent({
- type: 'component',
- id: 'channels',
- });
- const mailWidth = previewControllerWidthForContent({
- type: 'component',
- id: 'mail',
- });
- const companiesWidth = previewControllerWidthForContent({
- type: 'component',
- id: 'companies',
- });
-
- expect(inboxWidth).toBe(360);
- expect(channelsWidth).not.toBe(inboxWidth);
- expect(mailWidth).not.toBe(inboxWidth);
- expect(companiesWidth).not.toBe(inboxWidth);
-
- const companiesWidthInNarrowViewport = previewControllerWidthForContent(
- { type: 'component', id: 'companies' },
- 100
- );
- const companiesWidthInWideViewport = previewControllerWidthForContent(
- { type: 'component', id: 'companies' },
- 10_000
- );
- expect(companiesWidthInNarrowViewport).toBeLessThan(
- companiesWidthInWideViewport!
- );
- expect(
- previewControllerWidthForContent({ type: 'component', id: 'settings' })
- ).toBeUndefined();
- expect(
- previewControllerWidthForContent({
- type: 'project',
- id: 'project-1',
- })
- ).toBe(440);
- });
-
- it('uses the configured list-view minimum only for Preview Controllers', () => {
- const previewController = { isPreviewController: true };
- const standaloneSplit = { isPreviewController: false };
- const listViewContent = { type: 'component' as const, id: 'inbox' };
-
- expect(
- splitMinWidthForContent(listViewContent, previewController)
- ).not.toBe(DEFAULT_SPLIT_MIN_WIDTH);
- expect(splitMinWidthForContent(listViewContent, standaloneSplit)).toBe(
- DEFAULT_SPLIT_MIN_WIDTH
- );
- expect(
- splitMinWidthForContent(
- { type: 'component', id: 'settings' },
- previewController
- )
- ).toBe(DEFAULT_SPLIT_MIN_WIDTH);
- expect(
- splitMinWidthForContent({ type: 'md', id: 'doc-1' }, previewController)
- ).toBe(DEFAULT_SPLIT_MIN_WIDTH);
- });
-});
diff --git a/apps/web/src/components/app/split-layout/tests/previewPersistence.test.ts b/apps/web/src/components/app/split-layout/tests/previewPersistence.test.ts
deleted file mode 100644
index 83865eda84..0000000000
--- a/apps/web/src/components/app/split-layout/tests/previewPersistence.test.ts
+++ /dev/null
@@ -1,188 +0,0 @@
-import { describe, expect, it, vi } from 'vitest';
-import {
- loadRestorablePreviewLayout,
- remapPreviewQueryForRemovedSplit,
- serializePreviewPairs,
-} from '../previewPersistence';
-
-vi.mock('../layoutUtils', () => ({
- decodePairs: (segments: string[]) => {
- const pairs: Array<{ type: string; id: string }> = [];
- for (let index = 0; index < segments.length; index += 2) {
- const type = segments[index];
- const id = segments[index + 1];
- if (!type || !id) break;
- pairs.push({ type, id });
- }
- return pairs.length > 0 ? pairs : [{ type: 'component', id: 'inbox' }];
- },
-}));
-
-const controllerAndPlaceholder = [
- 'component',
- 'mail',
- 'component',
- 'preview-empty',
-];
-
-describe('Preview Pair URL state', () => {
- it('serializes one or more Preview Pairs in Controller order', () => {
- expect(
- serializePreviewPairs([{ controllerIndex: 2 }, { controllerIndex: 0 }])
- ).toBe('0_2');
- expect(serializePreviewPairs([])).toBeUndefined();
- });
-
- it('restores a copied placeholder Preview Pair', () => {
- expect(loadRestorablePreviewLayout(controllerAndPlaceholder, '0')).toEqual({
- contents: [
- { type: 'component', id: 'mail' },
- { type: 'component', id: 'preview-empty' },
- ],
- previewPairs: [{ controllerIndex: 0 }],
- });
- });
-
- it('restores a Preview Pair after the Viewer has real content', () => {
- const segments = ['component', 'mail', 'md', 'doc-1'];
-
- expect(loadRestorablePreviewLayout(segments, '0')).toEqual({
- contents: [
- { type: 'component', id: 'mail' },
- { type: 'md', id: 'doc-1' },
- ],
- previewPairs: [{ controllerIndex: 0 }],
- });
- });
-
- it('restores a Preview Pair whose Viewer is itself controller-eligible', () => {
- // A Project controlling another Project is a valid runtime pair
- // (canLinkPreviewPair only constrains the Controller), so it must survive
- // a URL round trip.
- const segments = ['project', 'proj-controller', 'project', 'proj-viewer'];
-
- expect(loadRestorablePreviewLayout(segments, '0')).toEqual({
- contents: [
- { type: 'project', id: 'proj-controller' },
- { type: 'project', id: 'proj-viewer' },
- ],
- previewPairs: [{ controllerIndex: 0 }],
- });
- });
-
- it('restores multiple non-overlapping Preview Pairs', () => {
- const segments = [
- 'component',
- 'mail',
- 'component',
- 'preview-empty',
- 'component',
- 'channels',
- 'md',
- 'doc-1',
- ];
-
- expect(loadRestorablePreviewLayout(segments, '0_2')).toEqual({
- contents: [
- { type: 'component', id: 'mail' },
- { type: 'component', id: 'preview-empty' },
- { type: 'component', id: 'channels' },
- { type: 'md', id: 'doc-1' },
- ],
- previewPairs: [{ controllerIndex: 0 }, { controllerIndex: 2 }],
- });
- });
-
- it('removes a bare preview placeholder without a query Preview Pair', () => {
- expect(
- loadRestorablePreviewLayout(controllerAndPlaceholder, undefined)
- ).toEqual({
- contents: [{ type: 'component', id: 'mail' }],
- previewPairs: [],
- });
- });
-
- it('keeps valid tuples while dropping malformed and overlapping tuples', () => {
- const segments = [
- 'component',
- 'mail',
- 'md',
- 'doc-1',
- 'component',
- 'channels',
- 'md',
- 'doc-2',
- ];
-
- expect(
- loadRestorablePreviewLayout(segments, 'bad_0_0_nope_2').previewPairs
- ).toEqual([{ controllerIndex: 0 }, { controllerIndex: 2 }]);
- });
-
- it('rejects out-of-bounds and content-invalid tuples', () => {
- expect(
- loadRestorablePreviewLayout(
- ['component', 'settings', 'md', 'doc-1'],
- '0_4'
- )
- ).toEqual({
- contents: [
- { type: 'component', id: 'settings' },
- { type: 'md', id: 'doc-1' },
- ],
- previewPairs: [],
- });
- });
-
- it('rejects repeated query parameters as non-canonical', () => {
- expect(
- loadRestorablePreviewLayout(controllerAndPlaceholder, ['0', '2'])
- ).toEqual({
- contents: [{ type: 'component', id: 'mail' }],
- previewPairs: [],
- });
- });
-
- it('falls back to inbox when a placeholder is the only URL entry', () => {
- expect(
- loadRestorablePreviewLayout(['component', 'preview-empty'], undefined)
- ).toEqual({
- contents: [{ type: 'component', id: 'inbox' }],
- previewPairs: [],
- });
- });
-
- it('filters preview state when Preview Pairs are disabled', () => {
- expect(
- loadRestorablePreviewLayout(controllerAndPlaceholder, '0', {
- allowPreviewPairs: false,
- })
- ).toEqual({
- contents: [{ type: 'component', id: 'mail' }],
- previewPairs: [],
- });
- });
-});
-
-describe('remapPreviewQueryForRemovedSplit', () => {
- it('keeps pairs before the removed split and shifts pairs after it', () => {
- expect(remapPreviewQueryForRemovedSplit('0_3', 2)).toBe('0_2');
- });
-
- it('shifts a pair down when an earlier split is removed', () => {
- expect(remapPreviewQueryForRemovedSplit('1', 0)).toBe('0');
- });
-
- it('drops a pair whose Controller was removed', () => {
- expect(remapPreviewQueryForRemovedSplit('1', 1)).toBeUndefined();
- });
-
- it('drops a pair whose Viewer was removed', () => {
- expect(remapPreviewQueryForRemovedSplit('1', 2)).toBeUndefined();
- });
-
- it('ignores absent and malformed values', () => {
- expect(remapPreviewQueryForRemovedSplit(undefined, 0)).toBeUndefined();
- expect(remapPreviewQueryForRemovedSplit('bad', 0)).toBeUndefined();
- });
-});
diff --git a/apps/web/src/components/app/split-layout/tests/registerSplitHotkeys.test.ts b/apps/web/src/components/app/split-layout/tests/registerSplitHotkeys.test.ts
index c3decf0956..08bb8b10d5 100644
--- a/apps/web/src/components/app/split-layout/tests/registerSplitHotkeys.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/registerSplitHotkeys.test.ts
@@ -37,8 +37,8 @@ describe('registerSplitHotkeys', () => {
vi.mocked(registerHotkey).mockClear();
});
- it('disables cmd+escape and opt+escape inside a Preview Pair Viewer', () => {
- let isPreviewSplit = true;
+ it('enables close shortcuts for multiple splits but not a sole list', () => {
+ let splitCount = 1;
registerSplitHotkeys({
splitHotkeyScope: 'split=test',
insertSplit: vi.fn(),
@@ -50,16 +50,15 @@ describe('registerSplitHotkeys', () => {
goForward: vi.fn(),
goToList: vi.fn(),
splitName: () => 'Test',
- getSplitCount: () => 2,
- isNotUnifiedList: () => true,
- isViewerSplit: () => isPreviewSplit,
+ getSplitCount: () => splitCount,
+ isNotUnifiedList: () => false,
});
const closeRegistration = vi.mocked(registerHotkey).mock.calls[0]?.[0];
expect(closeRegistration?.hotkey).toEqual(['cmd+escape', 'opt+escape']);
expect(closeRegistration?.condition?.()).toBe(false);
- isPreviewSplit = false;
+ splitCount = 2;
expect(closeRegistration?.condition?.()).toBe(true);
});
});
diff --git a/apps/web/src/components/app/split-layout/tests/splitFocusTracker.test.ts b/apps/web/src/components/app/split-layout/tests/splitFocusTracker.test.ts
index b981d51c8f..aa323e34cd 100644
--- a/apps/web/src/components/app/split-layout/tests/splitFocusTracker.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/splitFocusTracker.test.ts
@@ -11,7 +11,6 @@ import {
vi,
} from 'vitest';
import { createSplitLayout, type SplitId } from '../layoutManager';
-import { restorePreviewPairs } from '../layoutUrlSync';
import { createSplitFocusTracker } from '../splitFocusTracker';
vi.mock('../componentRegistry', () => ({
@@ -67,18 +66,15 @@ const FOCUS_DEBOUNCE_MS = 50;
/**
* Reproduce the fresh-load wiring of SplitLayoutContainer: the manager comes
- * up from URL contents (last split active), Preview Pairs restore, and only
- * then does the focus tracker mount and process the trailing Insert event.
+ * up from URL contents (last split active), then the focus tracker mounts
+ * and processes the trailing Insert event.
*/
-function mountFreshLoad(options: { withPreviewPair: boolean }) {
+function mountFreshLoad() {
return createRoot((dispose) => {
const manager = createSplitLayout(createMockOrchestrator(), [
{ type: 'component', id: 'inbox' },
{ type: 'md', id: 'doc-1' },
]);
- if (options.withPreviewPair) {
- restorePreviewPairs(manager, [{ controllerIndex: 0 }]);
- }
const panelRefs = new Map<SplitId, HTMLDivElement>(
manager.splits().map((split) => [split.id, createPanel()])
@@ -104,23 +100,8 @@ describe('createSplitFocusTracker', () => {
document.body.innerHTML = '';
});
- it('moves fresh-load focus to the Controller when the last URL split is a Preview Pair Viewer', () => {
- const { dispose, manager, panelRefs } = mountFreshLoad({
- withPreviewPair: true,
- });
- const [controller, viewer] = manager.splits();
-
- vi.advanceTimersByTime(FOCUS_DEBOUNCE_MS);
-
- expect(manager.controllerOf(viewer.id)).toBe(controller.id);
- expect(document.activeElement).toBe(panelRefs.get(controller.id));
- expect(manager.activeSplitId()).toBe(controller.id);
-
- dispose();
- });
-
it('cancels pending debounced focus when its owner is disposed', () => {
- const { dispose } = mountFreshLoad({ withPreviewPair: true });
+ const { dispose } = mountFreshLoad();
dispose();
vi.advanceTimersByTime(FOCUS_DEBOUNCE_MS);
@@ -128,10 +109,8 @@ describe('createSplitFocusTracker', () => {
expect(document.activeElement).toBe(document.body);
});
- it('keeps fresh-load focus on the last split when it is not a Viewer', () => {
- const { dispose, manager, panelRefs } = mountFreshLoad({
- withPreviewPair: false,
- });
+ it('keeps fresh-load focus on the last split', () => {
+ const { dispose, manager, panelRefs } = mountFreshLoad();
const [, last] = manager.splits();
vi.advanceTimersByTime(FOCUS_DEBOUNCE_MS);
diff --git a/apps/web/src/components/app/split-layout/usePreviewToggle.ts b/apps/web/src/components/app/split-layout/usePreviewToggle.ts
deleted file mode 100644
index fc0a9ef385..0000000000
--- a/apps/web/src/components/app/split-layout/usePreviewToggle.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { registerHotkey } from '@core/hotkey/hotkeys';
-import { TOKENS } from '@core/hotkey/tokens';
-import type { Accessor } from 'solid-js';
-import { useSplitPanelOrThrow } from './layoutUtils';
-
-export type UsePreviewToggleOptions = {
- disabled?: Accessor<boolean>;
- onEngage?: VoidFunction;
- onOpenChange?: (open: boolean) => void;
- registerHotkey?: boolean;
-};
-
-export function usePreviewToggle(options: UsePreviewToggleOptions = {}) {
- const panel = useSplitPanelOrThrow();
- const isViewer = () => panel.handle.isViewerSplit();
- const isOpen = () => panel.handle.isControllerSplit();
- const canEngage = () =>
- !(options.disabled?.() ?? false) && panel.handle.canEngagePreview();
- const canToggle = () => isOpen() || canEngage();
-
- const toggle = () => {
- if (isViewer()) return false;
-
- if (isOpen()) {
- panel.handle.disengagePreview();
- options.onOpenChange?.(false);
- return true;
- }
-
- if (!canEngage()) return false;
-
- panel.handle.engagePreview();
- if (!panel.handle.isControllerSplit()) return false;
-
- options.onOpenChange?.(true);
- options.onEngage?.();
- return true;
- };
-
- if (options.registerHotkey) {
- registerHotkey({
- hotkeyToken: TOKENS.unifiedList.togglePreview,
- scopeId: panel.splitHotkeyScope,
- description: 'Toggle preview',
- condition: () => !isViewer() && canToggle(),
- keyDownHandler: toggle,
- hotkey: 'space',
- });
- }
-
- return {
- canEngage,
- canToggle,
- isOpen,
- isViewer,
- toggle,
- };
-}
diff --git a/apps/web/src/features/block-channel/utils/link.ts b/apps/web/src/features/block-channel/utils/link.ts
index d43121f3d1..3cf84f2527 100644
--- a/apps/web/src/features/block-channel/utils/link.ts
+++ b/apps/web/src/features/block-channel/utils/link.ts
@@ -59,11 +59,7 @@ export async function navigateToChannelMessage(
options?: {
splitManager?: SplitManager;
preferNewSplit?: boolean;
- /**
- * The split this navigation originates from. When it is an engaged
- * preview controller, the open is redirected into its viewer split and
- * never steals the keyboard from the controller.
- */
+ /** The split this navigation originates from. */
sourceHandle?: SplitHandle;
}
) {
@@ -72,12 +68,7 @@ export async function navigateToChannelMessage(
const existing = splitManager.getSplitByContent('channel', channelId);
if (existing) {
- // The channel already showing in the source's own viewer is a plain
- // retarget; activating it would pull focus out of the controller.
- const isSourcesViewer =
- options?.sourceHandle?.isControllerSplit() &&
- options.sourceHandle.viewerId() === existing.id;
- if (!isSourcesViewer) existing.activate();
+ existing.activate();
} else {
splitManager.openWithSplit(
{
diff --git a/apps/web/src/features/block-chat/component/Chat.tsx b/apps/web/src/features/block-chat/component/Chat.tsx
index ee27c1fd9f..8ec3573454 100644
--- a/apps/web/src/features/block-chat/component/Chat.tsx
+++ b/apps/web/src/features/block-chat/component/Chat.tsx
@@ -306,8 +306,7 @@ function ChatInner(props: {
hotkeyToken: TOKENS.chat.stop,
});
- // J/K navigation focuses the block once it mounts, except when that block is
- // passive content in a Preview Pair Viewer.
+ // J/K navigation focuses mounted standalone blocks.
let hasRun = false;
createEffect(() => {
if (hasRun) return;
diff --git a/apps/web/src/features/block-email/component/Block.tsx b/apps/web/src/features/block-email/component/Block.tsx
index 7468e6b23d..0f9e3f6af5 100644
--- a/apps/web/src/features/block-email/component/Block.tsx
+++ b/apps/web/src/features/block-email/component/Block.tsx
@@ -1,7 +1,6 @@
import { displaySubject } from '@app/features/email-compose/core/subject-text';
import { useBlockEntityCommands } from '@app/features/next-soup/actions';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import { useSplitPanel } from '@components/app/split-layout/layoutUtils';
import { useBlockId } from '@core/block';
import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';
import { toEntityLoadError } from '@core/component/EntityLoadGate';
@@ -59,9 +58,6 @@ export default function BlockEmail() {
};
const notificationSource = useGlobalNotificationSource();
- // A Preview Pair Viewer shows the thread passively — wait longer before
- // marking it seen so scanning/previewing doesn't clear unread state.
- const isPreview = !!useSplitPanel()?.handle.isViewerSplit();
const title = () => {
const data = threadData();
@@ -80,7 +76,7 @@ export default function BlockEmail() {
notificationSource={notificationSource}
threadId={threadId()}
linkId={threadData()?.thread?.link_id}
- debounceTime={isPreview ? 1_500 : 100}
+ debounceTime={100}
onRetry={() => void threadQuery.refetch()}
>
<Show when={threadId()}>
diff --git a/apps/web/src/features/block-email/use-email-list-navigation.test.ts b/apps/web/src/features/block-email/use-email-list-navigation.test.ts
index 5a3292289e..e5d5f5e1df 100644
--- a/apps/web/src/features/block-email/use-email-list-navigation.test.ts
+++ b/apps/web/src/features/block-email/use-email-list-navigation.test.ts
@@ -35,7 +35,7 @@ vi.mock('@app/features/next-soup/soup-context', () => ({
useMaybeSoup: () => undefined,
}));
vi.mock('@app/signal/splitLayout', () => ({
- globalSplitManager: () => ({ controllerOf: () => undefined }),
+ globalSplitManager: () => undefined,
}));
vi.mock('@components/app/GlobalAppState', () => ({
useGlobalNotificationSource: () => undefined,
diff --git a/apps/web/src/features/block-email/use-email-list-navigation.ts b/apps/web/src/features/block-email/use-email-list-navigation.ts
index 6e4eeeb307..5979a14259 100644
--- a/apps/web/src/features/block-email/use-email-list-navigation.ts
+++ b/apps/web/src/features/block-email/use-email-list-navigation.ts
@@ -9,7 +9,6 @@ import {
getListNavigationSource,
listNavigationSourceId,
} from '@app/features/soup/collection/list-navigation-source';
-import { globalSplitManager } from '@app/signal/splitLayout';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { useSplitPanel } from '@components/app/split-layout/layoutUtils';
import { toast } from '@core/component/Toast/Toast';
@@ -30,10 +29,7 @@ export function useEmailListNavigation(
});
const source = () => {
if (!panel) return undefined;
- const manager = globalSplitManager();
- const controllerId = manager?.controllerOf(panel.handle.id);
- const handle =
- (controllerId && manager?.getSplit(controllerId)) || panel.handle;
+ const handle = panel.handle;
const list = getListNavigationSource(listNavigationSourceId(handle));
return list?.viewId === panel.handle.referredFrom() ? list : undefined;
};
diff --git a/apps/web/src/features/block-project/component/TopBar.tsx b/apps/web/src/features/block-project/component/TopBar.tsx
index 3fdadc5bc1..71fa88a1c8 100644
--- a/apps/web/src/features/block-project/component/TopBar.tsx
+++ b/apps/web/src/features/block-project/component/TopBar.tsx
@@ -10,7 +10,6 @@ import {
ResponsivePermissionsBadge,
ToolButton,
} from '@components/app/ResponsiveBlockToolbar';
-import { PreviewButton } from '@components/app/split-layout/components/PreviewButton';
import {
BlockSplitFileMenu,
type FileOperation,
@@ -149,7 +148,6 @@ export function TopBar() {
</Show>
)}
</For>
- <PreviewButton />
</SplitToolbarRight>
</Show>
<CreateDialog />
diff --git a/apps/web/src/features/drive-view/drive-host-actions.ts b/apps/web/src/features/drive-view/drive-host-actions.ts
index 8b3063db7b..04431d6617 100644
--- a/apps/web/src/features/drive-view/drive-host-actions.ts
+++ b/apps/web/src/features/drive-view/drive-host-actions.ts
@@ -95,7 +95,6 @@ export function createDriveHostActions(options: {
splitHandle: panel.handle,
referredFrom: 'documents',
openInNewSplit,
- replacePreview: event?.altKey && !openInNewSplit,
location,
notificationSource,
});
diff --git a/apps/web/src/features/drive-view/drive-view.tsx b/apps/web/src/features/drive-view/drive-view.tsx
index c20b510fc3..5ee70d24d8 100644
--- a/apps/web/src/features/drive-view/drive-view.tsx
+++ b/apps/web/src/features/drive-view/drive-view.tsx
@@ -104,7 +104,6 @@ function DriveComposition(props: DriveViewProps) {
showList: () => {
navigation.clear();
- panel.handle.resetPreview();
},
});
diff --git a/apps/web/src/features/drive-view/views/drive-list.tsx b/apps/web/src/features/drive-view/views/drive-list.tsx
index 34826990b2..66ae1f479a 100644
--- a/apps/web/src/features/drive-view/views/drive-list.tsx
+++ b/apps/web/src/features/drive-view/views/drive-list.tsx
@@ -215,7 +215,7 @@ export function DriveList() {
)
return;
- if (isTouchDevice() || panel.handle.isControllerSplit()) return;
+ if (isTouchDevice()) return;
list.focus.first({ reason: 'restore' });
});
@@ -399,9 +399,6 @@ export function DriveList() {
checked={list.selection.isSelected(row.id)}
onMouseMove={() => {
if (isKeypressActive()) return;
- if (panel.handle.isControllerSplit())
- return;
-
list.focus.set(row.id, { reason: 'hover' });
}}
onFilterByTag={(id) => state.setTags([id])}
diff --git a/apps/web/src/features/email-thread/thread-completion-adapter.tsx b/apps/web/src/features/email-thread/thread-completion-adapter.tsx
index 226ac34038..8601d439b0 100644
--- a/apps/web/src/features/email-thread/thread-completion-adapter.tsx
+++ b/apps/web/src/features/email-thread/thread-completion-adapter.tsx
@@ -284,7 +284,6 @@ export function createThreadCompletionAdapter(
const splitHandle = splitPanel?.handle;
if (!splitHandle) return;
if (!nextEntity) {
- splitHandle.resetPreview();
return;
}
diff --git a/apps/web/src/features/email-view/components/EmailControls.tsx b/apps/web/src/features/email-view/components/EmailControls.tsx
index 096d0e2e9d..555782bc03 100644
--- a/apps/web/src/features/email-view/components/EmailControls.tsx
+++ b/apps/web/src/features/email-view/components/EmailControls.tsx
@@ -1,7 +1,5 @@
import { ListFilterDropdown } from '@app/components/view-shell';
-import { PreviewButton } from '@components/app/split-layout/components/PreviewButton';
import { Show } from 'solid-js';
-import { useEmailView } from '../email-view-context';
import { useEmailFilters } from '../filters/use-email-filters';
export type EmailControlsProps = {
@@ -11,8 +9,6 @@ export type EmailControlsProps = {
};
export function EmailControls(props: EmailControlsProps) {
- const { setPreviewOpen } = useEmailView();
-
const filters = useEmailFilters();
return (
@@ -33,11 +29,6 @@ export function EmailControls(props: EmailControlsProps) {
</span>
</Show>
</div>
- <PreviewButton
- iconOnly
- class="rounded-lg"
- onOpenChange={setPreviewOpen}
- />
</div>
);
}
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsx
index ceceab41d0..1b9dedf939 100644
--- a/apps/web/src/features/email-view/components/EmailList.tsx
+++ b/apps/web/src/features/email-view/components/EmailList.tsx
@@ -28,14 +28,12 @@ import CaretDownIcon from '@phosphor/caret-down.svg';
import CheckIcon from '@phosphor/check.svg';
import SpinnerIcon from '@phosphor/spinner.svg';
import { createElementSize } from '@solid-primitives/resize-observer';
-import { debounce } from '@solid-primitives/scheduled';
import { Button, cn } from '@ui';
import {
createEffect,
createMemo,
createSignal,
Match,
- onCleanup,
type Setter,
Show,
Suspense,
@@ -81,8 +79,6 @@ export function EmailList(props: EmailListProps) {
options: {
event?: MouseEvent;
openInNewSplit?: boolean;
- replacePreview?: boolean;
- mergeHistory?: boolean;
} = {}
) {
const finishTouchHighlight = options.event
@@ -93,17 +89,9 @@ export function EmailList(props: EmailListProps) {
splitHandle: panel.handle,
referredFrom: 'mail',
openInNewSplit: options.openInNewSplit,
- replacePreview: options.replacePreview,
- mergeHistory: options.mergeHistory,
}).finally(() => finishTouchHighlight?.());
}
- const previewAfterNavigation = debounce(
- (entity: EntityData) => openEntity(entity, { mergeHistory: true }),
- 150
- );
- onCleanup(() => previewAfterNavigation.clear());
-
function onActivate({
item,
metadata,
@@ -120,15 +108,12 @@ export function EmailList(props: EmailListProps) {
if (sourceRow?.kind !== 'entity') return;
- previewAfterNavigation.clear();
-
const newSplit =
metadata?.newSplit === true || metadata?.event?.shiftKey === true;
if (
!newSplit &&
metadata?.event?.altKey !== true &&
- !panel.handle.isControllerSplit() &&
openThread(
{ id: sourceRow.entity.id, fallbackName: sourceRow.entity.name },
{ event: metadata?.event }
@@ -139,7 +124,6 @@ export function EmailList(props: EmailListProps) {
openEntity(sourceRow.entity, {
event: metadata?.event,
openInNewSplit: newSplit,
- replacePreview: metadata?.event?.altKey === true && !newSplit,
});
}
@@ -246,13 +230,6 @@ export function EmailList(props: EmailListProps) {
enabled: panel.isPanelActive,
navigation: {
onNavigate: (event) => {
- previewAfterNavigation.clear();
-
- const row = event.result?.item;
- if (row?.kind === 'entity' && panel.handle.isControllerSplit()) {
- previewAfterNavigation(row.entity);
- }
-
if (event.kind !== 'move' || event.direction !== 1) return;
if (source.isLoadingMore() || !source.hasMore()) return;
@@ -340,7 +317,7 @@ export function EmailList(props: EmailListProps) {
}
// Switching tab or inbox scope is a new list: drop focus, selection, and
- // the preview, and start from the top.
+ // and start from the top.
const listScope = () =>
`${state.tab}|${state.inboxIds === undefined ? '*' : state.inboxIds.join(',')}`;
let activeScope = listScope();
@@ -349,10 +326,9 @@ export function EmailList(props: EmailListProps) {
if (nextScope === activeScope) return;
activeScope = nextScope;
- previewAfterNavigation.clear();
+
listInteractions.selection.clear();
list.focus.clear({ reason: 'programmatic' });
- panel.handle.resetPreview();
setPersistedListState((current) => ({ ...current, scrollOffset: 0 }));
});
@@ -367,10 +343,6 @@ export function EmailList(props: EmailListProps) {
});
if (restored) return;
if (isTouchDevice()) return;
- if (panel.handle.isControllerSplit()) {
- panel.handle.resetPreview();
- return;
- }
list.focus.first({
isNavigable: (row) => row.kind === 'entity',
@@ -556,8 +528,6 @@ export function EmailList(props: EmailListProps) {
const openInNewSplit = event.shiftKey;
openEntity(project, {
openInNewSplit,
- replacePreview:
- event.altKey && !openInNewSplit,
});
}}
onChecked={(selected, shiftKey) =>
diff --git a/apps/web/src/features/email-view/email-view-context.tsx b/apps/web/src/features/email-view/email-view-context.tsx
index 6fa88f881b..c34a3907f5 100644
--- a/apps/web/src/features/email-view/email-view-context.tsx
+++ b/apps/web/src/features/email-view/email-view-context.tsx
@@ -14,7 +14,6 @@ import { registerInboxFilterSplit } from '@app/features/next-soup/soup-view/inbo
import { normalizeFacetSelection } from '@app/features/soup';
import { registerListNavigationSource } from '@app/features/soup/collection/list-navigation-source';
import { makePersistedState } from '@app/lib/persistence';
-import { usePreference } from '@app/lib/preferences/use-preference';
import {
useSplitPanelOrThrow,
withSplitPanelOwner,
@@ -23,7 +22,7 @@ import { createAssertedContextProvider } from '@core/context/createContext';
import { useUserId } from '@core/context/user';
import { useTagSets, useTagSetsReady } from '@property/tags/tag-sets-context';
import type { ContextProviderProps } from '@solid-primitives/context';
-import { type Accessor, onCleanup, type Setter } from 'solid-js';
+import { type Accessor, onCleanup } from 'solid-js';
import {
createStore,
produce,
@@ -89,13 +88,6 @@ export type EmailViewContext = {
closeThread: () => void;
isSidebarSectionOpen: (id: string) => boolean;
setSidebarSectionOpen: (id: string, open: boolean) => void;
- /**
- * Whether the view may open its preview pane on its own. Written by the
- * Preview toggle so an explicit close stays closed across visits; shares
- * the legacy mail view's key so the choice carries over.
- */
- previewOpen: Accessor<boolean>;
- setPreviewOpen: Setter<boolean>;
};
export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
@@ -108,10 +100,6 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
const tagSets = useTagSets();
const tagSetsReady = useTagSetsReady();
const initial = props.initialState ?? {};
- const [previewOpen, setPreviewOpen] = usePreference<boolean>(
- 'macro:pref:soup:mail:preview-open',
- { default: true }
- );
const [state, setState] = makePersistedState(
createStore<EmailViewState>({
@@ -296,7 +284,5 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
closeThread,
isSidebarSectionOpen,
setSidebarSectionOpen,
- previewOpen,
- setPreviewOpen,
};
});
diff --git a/apps/web/src/features/entity/extractors-notification/notification-content.tsx b/apps/web/src/features/entity/extractors-notification/notification-content.tsx
index 9c4a8c5e64..c3f2984a63 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-content.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-content.tsx
@@ -27,8 +27,7 @@ export function DocumentMentionPill(props: {
notification: UnifiedNotification;
}) {
const notificationSource = useGlobalNotificationSource();
- // The containing split (when any) is the navigation source, so opens from
- // an engaged preview controller route into its viewer split.
+ // Keep navigation associated with the originating split.
const panel = useSplitPanel();
const { markAsDone } = useNotificationActions({
notification: props.notification,
diff --git a/apps/web/src/features/entity/extractors-notification/notification-row.tsx b/apps/web/src/features/entity/extractors-notification/notification-row.tsx
index 9e1ece4e6b..645a1a43e6 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-row.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-row.tsx
@@ -289,8 +289,7 @@ function ExpandedBody(props: BodyProps) {
*/
export function NotificationRow(props: NotificationRowProps) {
const notificationSource = useGlobalNotificationSource();
- // The containing split (when any) is the navigation source, so opens from
- // an engaged preview controller route into its viewer split.
+ // Keep navigation associated with the originating split.
const panel = useSplitPanel();
const unread = () => isNotificationUnread(props.notification);
const canMarkDone = () =>
diff --git a/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx b/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
index 512b49da64..a0036fa754 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
+++ b/apps/web/src/features/entity/extractors-notification/notification-stacks.tsx
@@ -54,8 +54,7 @@ export function NotificationStackRow(props: {
entityId: props.entity.id,
});
- // The containing split (when any) is the navigation source, so opens from
- // an engaged preview controller route into its viewer split.
+ // Keep navigation associated with the originating split.
const panel = useSplitPanel();
const handleClick = async (e: PointerEvent | MouseEvent | KeyboardEvent) => {
diff --git a/apps/web/src/features/getting-started/getting-started.tsx b/apps/web/src/features/getting-started/getting-started.tsx
index 3f8b993cc2..8af07d67df 100644
--- a/apps/web/src/features/getting-started/getting-started.tsx
+++ b/apps/web/src/features/getting-started/getting-started.tsx
@@ -46,10 +46,7 @@ import type {
GettingStartedSection as GettingStartedSectionConfig,
} from './getting-started-types';
-/**
- * Where new users arrive: activating actions in collapsible sections. Acts as
- * a Preview Pair Controller — action results open in the adjacent Viewer.
- */
+/** Actions that help new users get started. */
export function GettingStarted() {
const userId = useUserId();
@@ -93,21 +90,8 @@ function GettingStartedContent() {
// isFirstTimeOnboarding.
const [tutorialOpen, setTutorialOpen] = createSignal(false);
- /**
- * Open content beside the list: re-engage a manually-closed Viewer first so
- * the open lands there instead of replacing this panel, then route through
- * this panel's handle (a Controller-handle open is rewritten into its
- * Viewer). No-ops into a plain open on mobile or when there's no room.
- */
- const openInPreview = (content: SplitContent) => {
- if (
- !isMobile() &&
- !panel.handle.isControllerSplit() &&
- panel.handle.canEngagePreview()
- ) {
- panel.handle.engagePreview();
- }
- openWithSplit(content, { handle: panel.handle });
+ const openContent = (content: SplitContent) => {
+ openWithSplit(content, { handle: panel.handle, preferNewSplit: true });
};
const openSettingsTab = (tab: SettingsTab) => {
@@ -117,9 +101,8 @@ function GettingStartedContent() {
return;
}
setActiveTabId(tab);
- // Deliberately not openSettings(): on desktop it collapses to solo
- // settings, destroying the Controller/Viewer pair.
- openInPreview({ type: 'component', id: 'settings' });
+ // Keep getting started open beside settings when space allows.
+ openContent({ type: 'component', id: 'settings' });
};
const openChatPrompt = async (prompt: string): Promise<boolean> => {
@@ -141,7 +124,7 @@ function GettingStartedContent() {
attachments: [],
model: defaultModelForPlan(hasPaidAccess()),
});
- openInPreview({ type: 'chat', id: result.chatId });
+ openContent({ type: 'chat', id: result.chatId });
return true;
};
@@ -197,7 +180,7 @@ function GettingStartedContent() {
window.open(DOCS_BASE, '_blank', 'noopener,noreferrer');
return;
}
- openInPreview({ type: 'md', id: documentId });
+ openContent({ type: 'md', id: documentId });
},
},
{
@@ -271,12 +254,6 @@ function GettingStartedContent() {
onMount(() => {
panel.handle.setDisplayName('Getting started');
- // Preview is always on for Getting Started (no user toggle): engage
- // whenever this panel isn't itself someone's Viewer. engagePreview
- // no-ops on mobile and when there's no room; action opens re-engage if
- // the Viewer was closed (see openInPreview).
- if (panel.handle.isViewerSplit()) return;
- panel.handle.engagePreview();
});
return (
diff --git a/apps/web/src/features/next-soup/actions/make-edit-reminder-action.ts b/apps/web/src/features/next-soup/actions/make-edit-reminder-action.ts
index 86322e5457..b193172743 100644
--- a/apps/web/src/features/next-soup/actions/make-edit-reminder-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-edit-reminder-action.ts
@@ -9,8 +9,7 @@ import type { EntityActionListState } from './entity-action-context';
*
* Opens the reminder's editor the same way a row click does: through
* {@link openEntityInSplitFromUnifiedList}, which resolves the reminder to its
- * `reminder-view` split and previews it into the Viewer when driven from a
- * Preview Pair. Single-entity only, like creating one.
+ * `reminder-view` split. Single-entity only, like creating one.
*/
export const makeEditReminderAction = () => {
const canExecute = (entity: EntityData): boolean =>
diff --git a/apps/web/src/features/next-soup/actions/make-mark-done-action.test.ts b/apps/web/src/features/next-soup/actions/make-mark-done-action.test.ts
index 9f1ce59c93..843ba8048d 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-done-action.test.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-done-action.test.ts
@@ -1,4 +1,3 @@
-import type { SplitHandle } from '@components/app/split-layout/layoutManager';
import type { EntityData } from '@entity';
import type { NotificationSource } from '@notifications';
import { createRoot } from 'solid-js';
@@ -6,11 +5,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { SoupState } from '../create-soup-state';
const mocks = vi.hoisted(() => ({
- controller: {
+ splitHandle: {
content: vi.fn(() => ({ id: 'other' })),
- isControllerSplit: vi.fn(() => true),
referredFrom: vi.fn(() => undefined),
- resetPreview: vi.fn(),
},
executeMarkEntitiesDone: vi.fn(async () => [] as string[]),
executeMarkEntitiesUndone: vi.fn(async () => {}),
@@ -27,7 +24,7 @@ const mocks = vi.hoisted(() => ({
}));
vi.mock('@components/app/split-layout/layoutUtils', () => ({
- useSplitPanel: () => ({ handle: mocks.controller }),
+ useSplitPanel: () => ({ handle: mocks.splitHandle }),
}));
vi.mock('@core/constant/featureFlags', () => ({
@@ -134,10 +131,8 @@ describe('canExecuteMarkDoneOnView', () => {
describe('makeMarkDoneAction', () => {
beforeEach(() => {
- mocks.controller.content.mockReturnValue({ id: 'other' });
- mocks.controller.isControllerSplit.mockReturnValue(true);
- mocks.controller.referredFrom.mockReturnValue(undefined);
- mocks.controller.resetPreview.mockClear();
+ mocks.splitHandle.content.mockReturnValue({ id: 'other' });
+ mocks.splitHandle.referredFrom.mockReturnValue(undefined);
mocks.executeMarkEntitiesDone.mockClear();
mocks.executeMarkEntitiesDone.mockResolvedValue([]);
mocks.executeMarkEntitiesUndone.mockClear();
@@ -153,26 +148,7 @@ describe('makeMarkDoneAction', () => {
mocks.toNotificationEntityRef.mockReset();
});
- it('opens the next focused entity in an engaged Preview Controller', async () => {
- const { soup, focusSet } = createSoup();
- const { action, dispose } = createAction();
-
- await action.executeWithSoup([currentEntity], soup);
-
- expect(focusSet).toHaveBeenCalledWith('next-row');
- expect(mocks.openEntityInSplitFromUnifiedList).toHaveBeenCalledWith(
- nextEntity,
- {
- splitHandle: mocks.controller as unknown as SplitHandle,
- mergeHistory: true,
- notificationSource,
- }
- );
- dispose();
- });
-
- it('does not open the next entity when the split is not a Controller', async () => {
- mocks.controller.isControllerSplit.mockReturnValue(false);
+ it('moves list focus without opening the next entity', async () => {
const { soup } = createSoup();
const { action, dispose } = createAction();
@@ -182,7 +158,7 @@ describe('makeMarkDoneAction', () => {
dispose();
});
- it('uses an explicit navigation handler instead of the split Controller', async () => {
+ it('uses an explicit navigation handler to open the next entity', async () => {
const { soup } = createSoup();
const onNavigate = vi.fn();
const { action, dispose } = createAction();
@@ -261,7 +237,7 @@ describe('makeMarkDoneAction', () => {
it('keeps whole-channel inbox writes ID-based to exclude thread rows', async () => {
mocks.graphqlSoupEnabled.mockReturnValue(true);
- mocks.controller.content.mockReturnValue({ id: 'inbox' });
+ mocks.splitHandle.content.mockReturnValue({ id: 'inbox' });
mocks.resolveMarkEntitiesDoneVariables.mockReturnValue({
emailIds: [],
notificationIds: ['channel-notification'],
@@ -287,7 +263,7 @@ describe('makeMarkDoneAction', () => {
it('uses the canonical message entity for inbox channel-thread rows', async () => {
mocks.graphqlSoupEnabled.mockReturnValue(true);
- mocks.controller.content.mockReturnValue({ id: 'inbox' });
+ mocks.splitHandle.content.mockReturnValue({ id: 'inbox' });
mocks.resolveMarkEntitiesDoneVariables.mockReturnValue({
emailIds: [],
notificationIds: ['thread-notification'],
diff --git a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
index 731fe7f54b..c181195385 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
@@ -4,7 +4,6 @@ import {
executeMarkEntitiesDone,
executeMarkEntitiesUndone,
type MarkEntitiesDoneContext,
- openEntityInSplitFromUnifiedList,
resolveMarkEntitiesDoneVariables,
restoreSoupFocus,
} from '@app/features/next-soup/utils';
@@ -376,19 +375,6 @@ export const makeMarkDoneAction = (options: MakeMarkDoneOptions) => {
actionId: 'mark-done',
entity: nextRow?.original,
});
- } else {
- const controller = splitPanel?.handle;
- if (controller?.isControllerSplit()) {
- if (nextRow) {
- void openEntityInSplitFromUnifiedList(nextRow.original, {
- splitHandle: controller,
- mergeHistory: true,
- notificationSource: options.notificationSource(),
- });
- } else {
- controller.resetPreview();
- }
- }
}
// When marking done navigated the view to the next item, undo navigates
diff --git a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts b/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
index 3db7f08f16..dc3483d748 100644
--- a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
+++ b/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts
@@ -152,7 +152,6 @@ export const useBlockEntityCommands = (
const splitHandle = splitPanel?.handle;
if (!splitHandle) return;
if (!nextEntity) {
- splitHandle.resetPreview();
return;
}
diff --git a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
index 299f8e59c6..3ccc5b4da6 100644
--- a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
+++ b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts
@@ -127,20 +127,7 @@ export const useEntityActionHotkeys = (
const openNextEntity: EntityActionNavigationHandler = ({ entity }) => {
if (!splitHandle) return;
- if (!entity) {
- if (splitHandle.isControllerSplit()) splitHandle.resetPreview();
- return;
- }
-
- if (splitHandle.isControllerSplit()) {
- openEntityInSplitFromUnifiedList(entity, {
- splitHandle,
- mergeHistory: true,
- referredFrom: splitHandle.referredFrom(),
- notificationSource,
- });
- return;
- }
+ if (!entity) return;
const handleContent = splitHandle.content()?.type;
if (!handleContent) return;
diff --git a/apps/web/src/features/next-soup/preview-history.ts b/apps/web/src/features/next-soup/preview-history.ts
deleted file mode 100644
index a7b10dc1e6..0000000000
--- a/apps/web/src/features/next-soup/preview-history.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { SplitContent } from '@components/app/split-layout/layoutManager';
-
-const PREVIEW_SOURCE_ENTITY_ID_STATE_KEY = 'soup.previewSourceEntityId';
-
-/** Stamp the controller row identity onto a preview viewer history entry. */
-export function withPreviewSourceEntityId(
- content: SplitContent,
- entityId: string
-): SplitContent {
- return {
- ...content,
- state: {
- ...content.state,
- [PREVIEW_SOURCE_ENTITY_ID_STATE_KEY]: entityId,
- },
- };
-}
-
-/** The controller row that created this preview viewer history entry. */
-export function previewSourceEntityId(
- content: SplitContent
-): string | undefined {
- const value = content.state?.[PREVIEW_SOURCE_ENTITY_ID_STATE_KEY];
- return typeof value === 'string' ? value : undefined;
-}
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
index e01f460784..4d6e5c605b 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-filters-bar.tsx
@@ -9,7 +9,6 @@ import {
CompanyViewsMenu,
} from '@app/features/next-soup/soup-view/views/companies/CompanyViewsMenu';
import { CollapsibleToolbarItem } from '@components/app/split-layout/components/CollapsibleItem';
-import { PreviewButton } from '@components/app/split-layout/components/PreviewButton';
import {
SplitToolbarLeft,
SplitToolbarRight,
@@ -18,12 +17,7 @@ import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { createMemo, createSignal, Show } from 'solid-js';
-export function SoupFiltersBar(props: {
- variant?: 'default' | 'tag';
- hasPreviewItems: boolean;
- onPreviewEngage: () => void;
- onPreviewOpenChange?: (open: boolean) => void;
-}) {
+export function SoupFiltersBar(props: { variant?: 'default' | 'tag' }) {
const { resetToTabDefaults, consolidatedFiltersList } =
useFilterRefinements();
@@ -95,17 +89,6 @@ export function SoupFiltersBar(props: {
{(isCollapsed) => <CompanyViewsMenu hideLabel={isCollapsed()} />}
</CollapsibleToolbarItem>
</Show>
- <CollapsibleToolbarItem id="soup-toolbar-preview" priority={3}>
- {(isCollapsed) => (
- <PreviewButton
- disabled={!props.hasPreviewItems}
- disabledLabel="No items to preview"
- onEngage={props.onPreviewEngage}
- onOpenChange={props.onPreviewOpenChange}
- hideLabel={isCollapsed()}
- />
- )}
- </CollapsibleToolbarItem>
</SplitToolbarRight>
{/* Active filters bar - shown below the toolbar when there are filters */}
<Show when={!isSearchView() && !isTagView()}>
diff --git a/apps/web/src/features/next-soup/soup-view/non-member-channel-preview.tsx b/apps/web/src/features/next-soup/soup-view/non-member-channel-preview.tsx
deleted file mode 100644
index 300da8999b..0000000000
--- a/apps/web/src/features/next-soup/soup-view/non-member-channel-preview.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import EmptyStateChannelsGraphic from '@design/empty-state-channels.svg';
-import { useJoinChannelMutation } from '@queries/channel/join-links';
-import { EmptyStatePanel } from '@ui';
-
-/**
- * Preview-pane state for a focused channel the viewer is not a participant of
- * (a team channel of their team they haven't joined). The channel can't be
- * read yet, so instead of mounting the channel block the pane offers the join
- * action; once the join lands `onJoined` hands the Viewer off to the real
- * channel block (and the soup refetch flips the row's `isParticipant`).
- *
- * Takes plain display fields rather than the entity so it can render as a
- * Preview Pair Viewer component (opened from the controlling list).
- */
-export function NonMemberChannelPreview(props: {
- channelId: string;
- channelName: string;
- memberCount: number;
- onJoined?: () => void;
-}) {
- const joinMutation = useJoinChannelMutation({
- onSuccess: () => props.onJoined?.(),
- });
-
- const description = () => {
- const count = props.memberCount;
- const members =
- count > 0 ? ` (${count} ${count === 1 ? 'member' : 'members'})` : '';
- return `You're not in this channel yet${members}. Join it to read and send messages.`;
- };
-
- return (
- <EmptyStatePanel
- graphic={EmptyStateChannelsGraphic}
- title={props.channelName}
- description={description()}
- primaryAction={{
- label: joinMutation.isPending ? 'Joining…' : 'Join channel',
- onClick: () => {
- if (joinMutation.isPending) return;
- joinMutation.mutate({ channelId: props.channelId });
- },
- }}
- centered
- />
- );
-}
diff --git a/apps/web/src/features/next-soup/soup-view/preview-content-row.test.ts b/apps/web/src/features/next-soup/soup-view/preview-content-row.test.ts
deleted file mode 100644
index 013cfc4023..0000000000
--- a/apps/web/src/features/next-soup/soup-view/preview-content-row.test.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import type { SplitContent } from '@components/app/split-layout/layoutManager';
-import type { EntityData } from '@entity';
-import { describe, expect, it } from 'vitest';
-import { withPreviewSourceEntityId } from '../preview-history';
-import { previewContentMatchesEntity } from './preview-content-row';
-
-const channelMessage = (messageId: string): EntityData =>
- ({
- type: 'channel_message',
- id: `channel-1:${messageId}`,
- channelId: 'channel-1',
- messageId,
- }) as EntityData;
-
-const channelThread = (threadId: string): EntityData =>
- ({
- type: 'channel_thread',
- id: threadId,
- channelId: 'channel-1',
- messageId: threadId,
- threadId,
- }) as EntityData;
-
-describe('previewContentMatchesEntity', () => {
- it('prefers the stamped source row after history removes channel params', () => {
- const channel = { type: 'channel', id: 'channel-1' } as EntityData;
- const origin = channelThread('thread-2');
- const content = withPreviewSourceEntityId(
- { type: 'channel', id: 'channel-1' },
- origin.id
- );
-
- expect(
- [channel, origin].find((entity) =>
- previewContentMatchesEntity(content, entity)
- )
- ).toBe(origin);
- });
-
- it('retains direct entity id matching', () => {
- const entity = { id: 'document-1' } as EntityData;
-
- expect(
- previewContentMatchesEntity({ type: 'md', id: 'document-1' }, entity)
- ).toBe(true);
- });
-
- it('uses the message param to disambiguate rows from the same channel', () => {
- const other = channelMessage('message-1');
- const origin = channelMessage('message-2');
- const content: SplitContent = {
- type: 'channel',
- id: 'channel-1',
- params: { channel_message_id: 'message-2' },
- };
-
- expect(
- [other, origin].find((entity) =>
- previewContentMatchesEntity(content, entity)
- )
- ).toBe(origin);
- });
-
- it('uses the thread param to resolve the originating notification row', () => {
- const other = channelThread('thread-1');
- const origin = channelThread('thread-2');
- const content: SplitContent = {
- type: 'channel',
- id: 'channel-1',
- params: {
- channel_message_id: 'reply-2',
- channel_thread_id: 'thread-2',
- },
- };
-
- expect(
- [other, origin].find((entity) =>
- previewContentMatchesEntity(content, entity)
- )
- ).toBe(origin);
- });
-});
diff --git a/apps/web/src/features/next-soup/soup-view/preview-content-row.ts b/apps/web/src/features/next-soup/soup-view/preview-content-row.ts
deleted file mode 100644
index 1241a40110..0000000000
--- a/apps/web/src/features/next-soup/soup-view/preview-content-row.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
-import type { SplitContent } from '@components/app/split-layout/layoutManager';
-import type { EntityData } from '@entity';
-import { previewSourceEntityId } from '../preview-history';
-
-export function previewContentMatchesEntity(
- content: SplitContent,
- entity: EntityData
-) {
- const sourceEntityId = previewSourceEntityId(content);
- if (sourceEntityId !== undefined) return entity.id === sourceEntityId;
-
- if (entity.id === content.id) return true;
- if (content.type !== 'channel') return false;
- const params = content.params as
- | Record<string, string | undefined>
- | undefined;
-
- if (entity.type === 'channel_message') {
- return (
- entity.channelId === content.id &&
- entity.messageId === params?.[CHANNEL_PARAMS.message]
- );
- }
-
- if (entity.type === 'channel_thread') {
- return (
- entity.channelId === content.id &&
- entity.threadId === params?.[CHANNEL_PARAMS.thread]
- );
- }
-
- return false;
-}
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index 7b11df7529..ce4850399f 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -43,7 +43,6 @@ import {
const useCurrentListView = () => {
const panel = useSplitPanelOrThrow();
-
return createMemo<ListView | undefined>(() => {
const content = panel.handle.content();
@@ -75,7 +74,6 @@ export const shouldPreserveFiltersOnTabChange = (view: ListView) =>
export const useApplyPreset = () => {
const soup = useSoup();
- const panel = useSplitPanelOrThrow();
const {
queryFilters,
restorePersistedQueryFilters,
@@ -196,16 +194,12 @@ export const useApplyPreset = () => {
});
// The new tab replaces the dataset wholesale, and row focus only follows
- // a row that survives into it (see soup.setRows). When it doesn't,
- // nothing is selected anymore, so the Preview Pair's Viewer returns to
- // its placeholder instead of lingering on the previous tab's entity.
const focusedRow = soup.focus.row();
if (
!focusedRow ||
focusedRow.getIsGrouped() ||
focusedRow.getIsLoadMore()
) {
- panel.handle.resetPreview();
}
return true;
};
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index 6249d6a622..b8f091d34f 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -54,7 +54,6 @@ import {
markReminderSeenOnOpen,
openEntityInNewTab,
openEntityInSplitFromUnifiedList,
- preventDuplicatePreviewEntityOpen,
restoreSoupFocus,
} from '@app/features/next-soup/utils';
import {
@@ -134,7 +133,6 @@ import type { CacheSnapshot } from 'virtua/unstable_core';
import { SearchAskAiButton } from './search-ask-ai-button';
import { SoupEntitySelectionToolbar } from './soup-entity-selection-toolbar';
import { useSoupNavigationHotkeys } from './use-soup-navigation-hotkeys';
-import { useSoupPreviewAvailability } from './use-soup-preview-availability';
import { useSoupViewHotkeys } from './use-soup-view-hotkeys';
export const DefaultGroupHeader = (
@@ -215,7 +213,6 @@ const MobileTabLoadingBar = () => (
);
const SOUP_LIST_STATE_ENTRY_KEY = 'soup.listState';
-const DEFAULT_PREVIEW_VIEWS = new Set(['inbox', 'channels']);
/** The row components a soup view can render. */
type SoupRowComponent =
| typeof ListEntity
@@ -299,32 +296,8 @@ interface SoupViewProps {
export const SoupView = (props: SoupViewProps) => {
const soup = useSoup();
const panel = useSplitPanelOrThrow();
- const notificationSource = useGlobalNotificationSource();
const soupView = useSoupView();
const isInboxView = useIsInboxView();
- const openFocusedEntityInPreview = () => {
- const focusedRow = soup.focus.row();
- if (
- !focusedRow ||
- focusedRow.getIsGrouped() ||
- focusedRow.getIsLoadMore()
- ) {
- return;
- }
- void openEntityInSplitFromUnifiedList(focusedRow.original, {
- splitHandle: panel.handle,
- notificationSource,
- });
- };
- const hasPreviewItems = useSoupPreviewAvailability({
- rows: soupView.rows,
- isLoading: soupView.source.isLoading,
- isFetching: soupView.source.isFetching,
- isPlaceholderData: soupView.source.isPlaceholderData,
- splitHandle: panel.handle,
- onPreviewRestored: openFocusedEntityInPreview,
- });
-
const entryState = panel.handle.currentEntryState();
const contentId = panel.handle.content().id;
@@ -351,11 +324,6 @@ export const SoupView = (props: SoupViewProps) => {
`macro:pref:soup:${contentId}:sort`,
{ default: [] }
);
- const [previewOpenPreference, setPreviewOpenPreference] =
- usePreference<boolean>(`macro:pref:soup:${contentId}:preview-open`, {
- default: true,
- });
-
// Shared CRM view opened via a `?crmView=` link — only honored on the
// Customers view; its pieces win over persisted/preset values in init.
const initialCrmView =
@@ -462,38 +430,6 @@ export const SoupView = (props: SoupViewProps) => {
});
});
- // Preview-default views engage as soon as the layout can form a pair,
- // without waiting for rows. useSoupPreviewAvailability owns disengagement: a
- // settled result with no previewable rows only suspends the pair and
- // re-engages once an entity arrives, so an initially empty view still lands
- // in preview mode. Resolving here keeps a manual exit from being undone by
- // later Soup updates.
- //
- // The preference alone decides engagement, independent of navigation cause:
- // navigating the Controller away dissolves its Preview Pair, so an entry
- // restored via history back/forward has no pair left to revive and must
- // re-engage here like a fresh arrival. Manual toggles write the preference,
- // which keeps an explicit exit from being resurrected by history navigation.
- let initialPreviewResolved = false;
- createEffect(() => {
- if (initialPreviewResolved) return;
- if (!DEFAULT_PREVIEW_VIEWS.has(contentId) || !previewOpenPreference()) {
- initialPreviewResolved = true;
- return;
- }
- if (panel.handle.isViewerSplit()) {
- initialPreviewResolved = true;
- return;
- }
-
- // Split redistribution may still be reconciling after a hotkey-driven
- // replacement. Keep the effect live until engagement actually succeeds.
- if (!panel.handle.canEngagePreview()) return;
- soup.focus.clear();
- panel.handle.engagePreview();
- if (panel.handle.isControllerSplit()) initialPreviewResolved = true;
- });
-
onMount(() => {
if (contentId !== 'documents') return;
@@ -743,15 +679,7 @@ export const SoupView = (props: SoupViewProps) => {
</SplitHeaderRight>
</Show>
</div>
- <SoupFiltersBar
- variant={props.filterBarVariant}
- hasPreviewItems={hasPreviewItems()}
- onPreviewEngage={openFocusedEntityInPreview}
- onPreviewOpenChange={(open) => {
- if (DEFAULT_PREVIEW_VIEWS.has(contentId))
- setPreviewOpenPreference(open);
- }}
- />
+ <SoupFiltersBar variant={props.filterBarVariant} />
</Show>
<Show when={soupView.source.cachedMail?.()}>
<p role="status" class="px-4 py-1 text-xs text-ink-muted">
@@ -773,14 +701,13 @@ export const SoupView = (props: SoupViewProps) => {
</Suspense>
</div>
<Suspense>
- {/* The board and Preview Controller hide the AI bar: it floats over
+ {/* The board hides the AI bar: it floats over
content that is already constrained in both layouts. */}
<Show
when={
!isTouchDevice() &&
ENABLE_UNIFIED_LIST_AI_INPUT &&
!isInboxView() &&
- !panel.handle.isControllerSplit() &&
!isBoardRendered() &&
!isComponentListView('search')
}
@@ -920,8 +847,6 @@ const SoupViewListContent = (props: SoupViewListProps) => {
if (!focusEffectsEnabled() || !moveInitialFocus()) return;
if (!initialLoad || source.isLoading()) return;
- if (panel.handle.isControllerSplit()) return;
-
focusFirstEntity();
initialLoad = false;
})
@@ -934,8 +859,6 @@ const SoupViewListContent = (props: SoupViewListProps) => {
() => {
if (!focusEffectsEnabled()) return;
- if (panel.handle.isControllerSplit()) return;
-
focusFirstEntity();
},
{ defer: true }
@@ -1099,40 +1022,6 @@ const SoupViewListContent = (props: SoupViewListProps) => {
return;
}
- // Plain click while engaged as a Controller previews into the Viewer;
- // opt+click opens in place of the whole Preview Pair (the Viewer closes and
- // the content replaces this list); shift+click falls through to open a
- // fresh split instead. Non-member channels flow through to
- // openEntityInSplitFromUnifiedList, which shows the Viewer's Join prompt
- // when previewing and otherwise no-ops.
- if (
- panel.handle.isControllerSplit() &&
- type === 'entity' &&
- !event.shiftKey
- ) {
- if (
- !event.altKey &&
- preventDuplicatePreviewEntityOpen(entity, panel.handle)
- ) {
- return;
- }
-
- // Single click: focus the row AND open it in the Preview Pair's Viewer.
- // The openWithSplit redirect keeps the Viewer unfocused so keyboard
- // navigation stays in this list.
- if (args.rowIndex !== undefined) soup.focus.setIndex(args.rowIndex);
- else soup.focus.set(entity.id);
-
- await openEntityInSplitFromUnifiedList(entity, {
- location,
- splitHandle: panel.handle,
- replacePreview: event.altKey,
- referredFrom: currentView(),
- notificationSource,
- });
- return;
- }
-
const finishTouchHighlight = persistSoupNavigationTouchHighlight(event);
try {
@@ -1336,8 +1225,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
const cached = readListEntryState();
if (cached) {
- if (panel.handle.isControllerSplit()) soup.focus.clear();
- else soup.focus.set(cached.focus);
+ soup.focus.set(cached.focus);
const handle = virtualizerHandle();
if (!handle) return;
@@ -1350,8 +1238,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {
if (force) return;
restored = true;
- // Preview Controllers start without a focused row or Viewer content.
- registerFocusEffects(!panel.handle.isControllerSplit());
+ registerFocusEffects(true);
};
createEffect(
@@ -1654,8 +1541,6 @@ const SoupViewListContent = (props: SoupViewListProps) => {
highlighted={row.isFocused()}
onMouseMove={() => {
if (isKeypressActive()) return;
- if (panel.handle.isControllerSplit())
- return;
soup.focus.setIndex(row.index);
}}
showUnrollNotifications={
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.test.ts b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.test.ts
index dcd513cf8c..89646d5ecd 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.test.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.test.ts
@@ -20,8 +20,6 @@ vi.mock('@core/mobile/inputModality', () => ({
}));
vi.mock('@app/features/next-soup/utils', () => ({
- isDuplicatePreviewEntityOpen: vi.fn(() => false),
- notifyDuplicateContentOpen: vi.fn(),
openEntityInSplitFromUnifiedList: vi.fn(),
}));
@@ -134,8 +132,6 @@ const createSplitHandleStub = () =>
id: 'split-test',
content: () => ({ type: 'component', id: 'tasks' }),
referredFrom: () => undefined,
- isControllerSplit: () => false,
- viewerId: () => undefined,
registerEntryStateCaptor: () => () => {},
}) as unknown as SplitHandle;
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
index 64e454379c..0ea75fb471 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-navigation-hotkeys.ts
@@ -1,29 +1,17 @@
import { listOwnedSlotName } from '@app/components/list';
import { isListViewID } from '@app/constants/list-views';
-import {
- isDuplicatePreviewEntityOpen,
- notifyDuplicateContentOpen,
- openEntityInSplitFromUnifiedList,
-} from '@app/features/next-soup/utils';
+import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';
import { registerListNavigationSource } from '@app/features/soup/collection/list-navigation-source';
-import { globalSplitManager } from '@app/signal/splitLayout';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import type {
- SplitContent,
- SplitEvent,
- SplitEventPayload,
- SplitHandle,
-} from '@components/app/split-layout/layoutManager';
+import type { SplitHandle } from '@components/app/split-layout/layoutManager';
import { withSplitPanelOwner } from '@components/app/split-layout/layoutUtils';
import { entityIdSelector } from '@core/dom-selectors';
import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import type { EntityData } from '@entity';
-import { debounce } from '@solid-primitives/scheduled';
-import { type Accessor, createEffect, createMemo, onCleanup } from 'solid-js';
+import { type Accessor, createMemo, onCleanup } from 'solid-js';
import type { VirtualizerHandle } from 'virtua/solid';
import type { SoupState } from '../create-soup-state';
-import { previewContentMatchesEntity } from './preview-content-row';
type UseSoupNavigationHotkeysOptions = {
scopeId: string;
@@ -86,25 +74,7 @@ export const useSoupNavigationHotkeys = (
);
}
- // Row focus moves instantly on every keypress; the (expensive) block swap in
- // the Viewer trails the last press. mergeHistory keeps the Viewer's
- // history at a single scanning entry while holding j/k.
- const openInViewerDebounced = debounce((entity: EntityData) => {
- openEntityInSplitFromUnifiedList(entity, {
- splitHandle,
- mergeHistory: true,
- referredFrom: navigationReferredFrom(),
- notificationSource,
- });
- }, 150);
- onCleanup(() => openInViewerDebounced.clear());
-
const openEntity = (entity: EntityData) => {
- if (splitHandle.isControllerSplit()) {
- openInViewerDebounced(entity);
- return;
- }
-
const handleContent = splitHandle.content().type;
if (handleContent === 'component' || handleContent === 'project') return;
@@ -117,69 +87,8 @@ export const useSoupNavigationHotkeys = (
});
};
- // Group labels are structural rows — stepping with j/k or the arrow keys
- // moves through entities only and never focuses a header.
- const navigateToOpenableEntity = (offset: -1 | 1) => {
- let skippedDuplicate = false;
- const next = soup.navigate.by(offset, {
- skipGroupHeaders: true,
- skip: (row) => {
- if (
- !splitHandle.isControllerSplit() ||
- row.getIsGrouped() ||
- row.getIsLoadMore()
- ) {
- return false;
- }
- const blocked = isDuplicatePreviewEntityOpen(row.original, splitHandle);
- skippedDuplicate ||= blocked;
- return blocked;
- },
- });
- if (skippedDuplicate) notifyDuplicateContentOpen();
- return next;
- };
-
- /**
- * The row this preview-split content corresponds to, if it lives in this
- * list. Channel messages/threads open as their channel, so those rows are
- * matched through their channelId.
- */
- const rowForPreviewContent = (content: SplitContent) =>
- soup.rows().find((row) => {
- if (row.getIsGrouped() || row.getIsLoadMore()) return false;
- const entity = row.original as EntityData;
- if (!entity) return false;
- return previewContentMatchesEntity(content, entity);
- });
-
- // Preview history → list selection: stepping the Viewer's history
- // back or forward to content that was opened from this list re-selects the
- // corresponding row.
- createEffect(() => {
- const viewerId = splitHandle.viewerId();
- if (!viewerId) return;
- const viewer = globalSplitManager()?.getSplit(viewerId);
- if (!viewer) return;
-
- const syncSelection = (
- payload: SplitEventPayload[SplitEvent.ContentChange]
- ) => {
- if (
- payload.cause !== 'history-back' &&
- payload.cause !== 'history-forward'
- ) {
- return;
- }
- const row = rowForPreviewContent(payload.newContent);
- if (!row) return;
- const result = soup.navigate.toId(row.id);
- if (result) scrollTo(result.index);
- };
-
- viewer.registerContentChangeListener(syncSelection);
- onCleanup(() => viewer.unregisterContentChangeListener(syncSelection));
- });
+ const navigateToOpenableEntity = (offset: -1 | 1) =>
+ soup.navigate.by(offset, { skipGroupHeaders: true });
const navigateAndSelectEntity = (offset: number) => {
const nextRow = soup.navigate.by(offset, { skipGroupHeaders: true });
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.test.ts b/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.test.ts
deleted file mode 100644
index d449b48ed2..0000000000
--- a/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.test.ts
+++ /dev/null
@@ -1,291 +0,0 @@
-import type { SplitHandle } from '@components/app/split-layout/layoutManager';
-import { batch, createRoot, createSignal } from 'solid-js';
-import { describe, expect, it, vi } from 'vitest';
-import type { SoupRow } from '../create-soup-state';
-import {
- hasPreviewableSoupRows,
- useSoupPreviewAvailability,
-} from './use-soup-preview-availability';
-
-const row = (
- options: { grouped?: boolean; loadMore?: boolean } = {}
-): SoupRow =>
- ({
- getIsGrouped: () => options.grouped ?? false,
- getIsLoadMore: () => options.loadMore ?? false,
- }) as SoupRow;
-
-const flushEffects = () => Promise.resolve();
-
-/**
- * A SplitHandle stub whose controller role follows engage/disengage calls,
- * mirroring how the layout manager reports a Preview Pair.
- */
-const splitHandleStub = (options: { controller: boolean; room?: boolean }) => {
- let controller = options.controller;
- const engagePreview = vi.fn(() => {
- controller = true;
- });
- const disengagePreview = vi.fn(() => {
- controller = false;
- });
- return {
- engagePreview,
- disengagePreview,
- exitPreviewAsUser: () => {
- controller = false;
- },
- handle: {
- isControllerSplit: () => controller,
- isViewerSplit: () => false,
- canEngagePreview: () => options.room ?? true,
- engagePreview,
- disengagePreview,
- } as unknown as SplitHandle,
- };
-};
-
-type HarnessOptions = {
- rows?: SoupRow[];
- isLoading?: boolean;
- isFetching?: boolean;
- isPlaceholderData?: boolean;
- controller?: boolean;
- room?: boolean;
- onPreviewRestored?: () => void;
-};
-
-const createHarness = (initial: HarnessOptions = {}) => {
- const stub = splitHandleStub({
- controller: initial.controller ?? true,
- room: initial.room,
- });
- let dispose!: () => void;
- let setRows!: (rows: SoupRow[]) => void;
- let setLoading!: (loading: boolean) => void;
- let setFetching!: (fetching: boolean) => void;
- let setPlaceholderData!: (placeholder: boolean) => void;
-
- createRoot((rootDispose) => {
- dispose = rootDispose;
- const [rows, updateRows] = createSignal(initial.rows ?? [row()]);
- const [isLoading, updateLoading] = createSignal(initial.isLoading ?? false);
- const [isFetching, updateFetching] = createSignal(
- initial.isFetching ?? false
- );
- const [isPlaceholderData, updatePlaceholderData] = createSignal(
- initial.isPlaceholderData ?? false
- );
- setRows = updateRows;
- setLoading = updateLoading;
- setFetching = updateFetching;
- setPlaceholderData = updatePlaceholderData;
- useSoupPreviewAvailability({
- rows,
- isLoading,
- isFetching,
- isPlaceholderData,
- splitHandle: stub.handle,
- onPreviewRestored: initial.onPreviewRestored,
- });
- });
-
- return {
- engagePreview: stub.engagePreview,
- disengagePreview: stub.disengagePreview,
- exitPreviewAsUser: stub.exitPreviewAsUser,
- dispose,
- setRows,
- setLoading,
- setFetching,
- setPlaceholderData,
- };
-};
-
-describe('Soup preview availability', () => {
- it('requires an entity row rather than a group or load-more row', () => {
- expect(
- hasPreviewableSoupRows([row({ grouped: true }), row({ loadMore: true })])
- ).toBe(false);
- expect(hasPreviewableSoupRows([row({ grouped: true }), row()])).toBe(true);
- });
-
- it('disengages preview when the last entity row disappears', async () => {
- const harness = createHarness();
-
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- harness.setRows([]);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
- harness.dispose();
- });
-
- it('keeps preview open while an empty result is still loading', async () => {
- const harness = createHarness({ rows: [], isLoading: true });
-
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- harness.setLoading(false);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
- harness.dispose();
- });
-
- it('keeps preview open across a tab switch whose fetch repopulates the rows', async () => {
- const harness = createHarness();
-
- await flushEffects();
-
- // Tab switch: the kept-previous rows all fail the next tab's client
- // predicates (e.g. Signal rows never match Noise) while its uncached
- // query is in flight — `isLoading` stays false the whole time.
- batch(() => {
- harness.setRows([]);
- harness.setFetching(true);
- });
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- batch(() => {
- harness.setRows([row()]);
- harness.setFetching(false);
- });
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
- expect(harness.engagePreview).not.toHaveBeenCalled();
- harness.dispose();
- });
-
- it('keeps preview open while rows are placeholder data from the previous tab', async () => {
- const harness = createHarness();
-
- await flushEffects();
-
- batch(() => {
- harness.setRows([]);
- harness.setPlaceholderData(true);
- });
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- batch(() => {
- harness.setRows([row()]);
- harness.setPlaceholderData(false);
- });
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
- harness.dispose();
- });
-
- it('disengages preview once a fetch settles on an empty result', async () => {
- const harness = createHarness();
-
- await flushEffects();
-
- batch(() => {
- harness.setRows([]);
- harness.setFetching(true);
- });
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- harness.setFetching(false);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
- harness.dispose();
- });
-
- it('re-engages preview when entities return after an empty state', async () => {
- const onPreviewRestored = vi.fn();
- const harness = createHarness({ onPreviewRestored });
-
- await flushEffects();
- harness.setRows([]);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
- expect(harness.engagePreview).not.toHaveBeenCalled();
-
- harness.setRows([row()]);
- await flushEffects();
- expect(harness.engagePreview).toHaveBeenCalledOnce();
- expect(onPreviewRestored).toHaveBeenCalledOnce();
- harness.dispose();
- });
-
- it('waits for the returning result to settle before restoring preview', async () => {
- const onPreviewRestored = vi.fn();
- const harness = createHarness({ onPreviewRestored });
-
- await flushEffects();
- harness.setRows([]);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
-
- // Entities reappear while their fetch is still in flight (e.g. an
- // optimistic insert): the suspension must not restore mid-flight.
- batch(() => {
- harness.setRows([row()]);
- harness.setFetching(true);
- });
- await flushEffects();
- expect(harness.engagePreview).not.toHaveBeenCalled();
-
- harness.setFetching(false);
- await flushEffects();
- expect(harness.engagePreview).toHaveBeenCalledOnce();
- expect(onPreviewRestored).toHaveBeenCalledOnce();
- harness.dispose();
- });
-
- it('does not re-engage after the user exits preview mode', async () => {
- const harness = createHarness();
-
- await flushEffects();
- harness.exitPreviewAsUser();
-
- harness.setRows([]);
- await flushEffects();
- expect(harness.disengagePreview).not.toHaveBeenCalled();
-
- harness.setRows([row()]);
- await flushEffects();
- expect(harness.engagePreview).not.toHaveBeenCalled();
- harness.dispose();
- });
-
- it('does not engage when preview was never on', async () => {
- const harness = createHarness({ rows: [], controller: false });
-
- await flushEffects();
- harness.setRows([row()]);
- await flushEffects();
- expect(harness.engagePreview).not.toHaveBeenCalled();
- harness.dispose();
- });
-
- it('consumes the suspension when there is no room to restore', async () => {
- const onPreviewRestored = vi.fn();
- const harness = createHarness({ room: false, onPreviewRestored });
-
- await flushEffects();
- harness.setRows([]);
- await flushEffects();
- expect(harness.disengagePreview).toHaveBeenCalledOnce();
-
- harness.setRows([row()]);
- await flushEffects();
- expect(harness.engagePreview).not.toHaveBeenCalled();
- expect(onPreviewRestored).not.toHaveBeenCalled();
-
- // The consumed suspension cannot re-engage on a later cycle either.
- harness.setRows([]);
- await flushEffects();
- harness.setRows([row()]);
- await flushEffects();
- expect(harness.engagePreview).not.toHaveBeenCalled();
- harness.dispose();
- });
-});
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.ts b/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.ts
deleted file mode 100644
index ae66ce7d43..0000000000
--- a/apps/web/src/features/next-soup/soup-view/use-soup-preview-availability.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import type { SoupRow } from '@app/features/next-soup/create-soup-state';
-import type { SplitHandle } from '@components/app/split-layout/layoutManager';
-import { type Accessor, createEffect, createMemo, untrack } from 'solid-js';
-
-export function hasPreviewableSoupRows(rows: readonly SoupRow[]): boolean {
- return rows.some((row) => !row.getIsGrouped() && !row.getIsLoadMore());
-}
-
-/**
- * Tracks whether a Soup view has an entity that can be previewed. A settled
- * result with no such entities suspends the view's Preview Pair rather than
- * ending it: preview mode disengages while the view is empty and re-engages
- * as soon as an entity returns. Only exits that happen outside this hook —
- * the user toggling preview off, closing the Viewer, layout constraints —
- * are permanent.
- *
- * A result is only settled once nothing is in flight. `isLoading` alone
- * doesn't cover a tab switch: both soup sources keep the previous tab's rows
- * on screen while the next tab's (uncached) query loads, and those rows are
- * immediately re-filtered by the next tab's client predicates. When none of
- * them match (e.g. Signal rows never match Noise), rows are transiently empty
- * while `isLoading` is already false — so the fetch state must also hold the
- * preview open.
- */
-export function useSoupPreviewAvailability(options: {
- rows: Accessor<readonly SoupRow[]>;
- isLoading: Accessor<boolean>;
- /** True while any fetch for the active filters is in flight. */
- isFetching: Accessor<boolean>;
- /** True while rows still belong to the previous query key (tab switch). */
- isPlaceholderData: Accessor<boolean>;
- splitHandle: SplitHandle;
- /** Called after an empty-state suspension ends with preview re-engaged. */
- onPreviewRestored?: () => void;
-}): Accessor<boolean> {
- const hasPreviewItems = createMemo(() =>
- hasPreviewableSoupRows(options.rows())
- );
-
- const isSettled = () =>
- !options.isLoading() &&
- !options.isFetching() &&
- !options.isPlaceholderData();
-
- // Set only when this hook disengages preview itself, so an empty state is
- // a suspension while every other exit stays permanent.
- let suspended = false;
-
- createEffect(() => {
- if (!isSettled()) return;
-
- if (!hasPreviewItems()) {
- if (options.splitHandle.isControllerSplit()) {
- suspended = true;
- options.splitHandle.disengagePreview();
- }
- return;
- }
-
- if (!suspended) return;
- // A failed restore (e.g. no room for the Viewer) consumes the
- // suspension instead of re-engaging on an unrelated later layout change.
- suspended = false;
- untrack(() => {
- if (
- options.splitHandle.isViewerSplit() ||
- options.splitHandle.isControllerSplit() ||
- !options.splitHandle.canEngagePreview()
- ) {
- return;
- }
- options.splitHandle.engagePreview();
- if (options.splitHandle.isControllerSplit()) {
- options.onPreviewRestored?.();
- }
- });
- });
-
- return hasPreviewItems;
-}
diff --git a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
index 68d4fdedf0..8392d8bb16 100644
--- a/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
+++ b/apps/web/src/features/next-soup/soup-view/use-soup-view-hotkeys.ts
@@ -209,47 +209,6 @@ export const useSoupViewHotkeys = (options: UseSoupViewHotkeysOptions) => {
displayPriority: 4,
}).withGroup(group);
- // cmd+enter - Focus preview block
- registerHotkey({
- hotkey: ['cmd+enter'],
- scopeId,
- description: 'Focus Preview',
- condition: () => splitHandle.isControllerSplit(),
- keyDownHandler: () => {
- const manager = globalSplitManager();
- const viewerId = splitHandle.viewerId();
- if (splitHandle.isControllerSplit() && viewerId && manager) {
- manager.activateSplit(viewerId);
- manager.returnFocus();
- return true;
- }
- return false;
- },
- displayPriority: 4,
- }).withGroup(group);
-
- // opt+enter - Open in place of the whole Preview Pair
- registerHotkey({
- hotkey: ['opt+enter'],
- scopeId,
- description: 'Open to replace preview',
- condition: () =>
- splitHandle.isControllerSplit() && soup.focus.id() !== undefined,
- keyDownHandler: () => {
- const entity = soup.focus.item();
- if (!entity) return false;
- markReminderSeenOnOpen(entity, notificationSource);
- openEntityInSplitFromUnifiedList(entity, {
- splitHandle,
- replacePreview: true,
- referredFrom: currentView(),
- notificationSource,
- });
- return true;
- },
- hide: true,
- }).withGroup(group);
-
// x - Toggle select item
registerHotkey({
hotkey: ['x'],
diff --git a/apps/web/src/features/next-soup/soup-view/views/companies/CompanyKanban.tsx b/apps/web/src/features/next-soup/soup-view/views/companies/CompanyKanban.tsx
index 780892a030..43966dcf39 100644
--- a/apps/web/src/features/next-soup/soup-view/views/companies/CompanyKanban.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/companies/CompanyKanban.tsx
@@ -3,10 +3,7 @@ import { NO_STAGE } from '@app/features/next-soup/filters/configs/';
import { EmptyState } from '@app/features/next-soup/soup-view/empty-states';
import { useFilterRefinements } from '@app/features/next-soup/soup-view/filters-bar/use-filter-refinements';
import { useSoupView } from '@app/features/next-soup/soup-view/soup-view-context';
-import {
- openEntityInSplitFromUnifiedList,
- preventDuplicatePreviewEntityOpen,
-} from '@app/features/next-soup/utils';
+import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';
import { SoupEntityContextMenu } from '@app/features/soup';
import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
import { useDealStages } from '@companies/crm/deal-stages';
@@ -265,23 +262,10 @@ export function CompanyKanban(props: {
props.onOpenEntity?.(entity)
)
return;
- // Shift+click always opens a fresh split; opt+click replaces the whole
- // Preview Pair; a plain click while engaged as a Controller previews into
- // the Viewer and shouldn't re-open an entity already shown elsewhere.
- // Matches the list view's onEntityClick.
- if (
- !event.shiftKey &&
- !event.altKey &&
- panel.handle.isControllerSplit() &&
- preventDuplicatePreviewEntityOpen(entity, panel.handle)
- ) {
- return;
- }
soup.focus.set(entity.id);
void openEntityInSplitFromUnifiedList(entity, {
openInNewSplit: event.shiftKey,
- replacePreview: !event.shiftKey && event.altKey,
splitHandle: panel.handle,
referredFrom: 'companies',
});
diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.ts
index b918438181..c96eb452df 100644
--- a/apps/web/src/features/next-soup/utils.test.ts
+++ b/apps/web/src/features/next-soup/utils.test.ts
@@ -97,20 +97,15 @@ vi.mock('@core/constant/featureFlags', async (importOriginal) => {
});
import { setGlobalSplitManager } from '@app/signal/splitLayout';
-import type {
- SplitHandle,
- SplitManager,
-} from '@components/app/split-layout/layoutManager';
+import type { SplitManager } from '@components/app/split-layout/layoutManager';
import type { ChannelEntityTarget, EntityData } from '@entity';
import type { NotificationSource, UnifiedNotification } from '@notifications';
-import { previewSourceEntityId } from './preview-history';
import {
executeMarkEntitiesDone,
getChannelEntityTarget,
getRowClickFallbackLocation,
markChannelNotificationsSeenOnOpen,
openEntityInSplitFromUnifiedList,
- preventDuplicatePreviewEntityOpen,
resolveMarkEntitiesDoneVariables,
} from './utils';
@@ -307,36 +302,6 @@ describe('mark-done orchestration', () => {
});
});
-describe('preview duplicate navigation', () => {
- it('rejects content owned by a different preview viewer and notifies', () => {
- const controller = {
- viewerId: () => 'viewer-1',
- } as unknown as SplitHandle;
- setGlobalSplitManager({
- getSplitByContent: vi.fn(() => ({ id: 'viewer-2' })),
- } as unknown as SplitManager);
-
- expect(preventDuplicatePreviewEntityOpen(channelRow(), controller)).toBe(
- true
- );
- expect(toastAlert).toHaveBeenCalledWith('Content already open.');
- });
-
- it('allows content already displayed by the controller own viewer', () => {
- const controller = {
- viewerId: () => 'viewer-1',
- } as unknown as SplitHandle;
- setGlobalSplitManager({
- getSplitByContent: vi.fn(() => ({ id: 'viewer-1' })),
- } as unknown as SplitManager);
-
- expect(preventDuplicatePreviewEntityOpen(channelRow(), controller)).toBe(
- false
- );
- expect(toastAlert).not.toHaveBeenCalled();
- });
-});
-
describe('calendar block navigation', () => {
it('opens and targets the singleton calendar block', async () => {
const openWithSplit = vi.fn();
@@ -389,109 +354,6 @@ describe('calendar block navigation', () => {
expect.objectContaining({ eventId: 'event-1' })
);
});
-
- it('retargets a calendar preview without activating its viewer', async () => {
- const activate = vi.fn();
- const openWithSplit = vi.fn();
- const goToLocationFromParams = vi.fn();
- const getBlockHandle = vi.fn(async () => ({ goToLocationFromParams }));
- const controller = {
- isControllerSplit: () => true,
- viewerId: () => 'viewer-1',
- } as unknown as SplitHandle;
-
- setGlobalSplitManager({
- activeSplit: vi.fn(),
- getOrchestrator: vi.fn(() => ({ getBlockHandle })),
- getSplitByContent: vi.fn(() => ({
- id: 'viewer-1',
- activate,
- })),
- openWithSplit,
- } as unknown as SplitManager);
-
- await openEntityInSplitFromUnifiedList(
- {
- type: 'calendar_event',
- id: 'event-2',
- } as unknown as EntityData,
- { splitHandle: controller, mergeHistory: true }
- );
-
- expect(activate).not.toHaveBeenCalled();
- expect(openWithSplit).toHaveBeenCalledWith(
- expect.objectContaining({
- type: 'calendar',
- id: 'view',
- }),
- expect.objectContaining({
- handle: controller,
- mergeHistory: true,
- })
- );
- });
-});
-
-describe('preview history source', () => {
- it('stamps the originating controller entity on viewer content', async () => {
- const openWithSplit = vi.fn();
- const controller = {
- content: () => ({ type: 'component', id: 'inbox' }),
- isControllerSplit: () => true,
- viewerId: () => 'viewer-1',
- } as unknown as SplitHandle;
- setGlobalSplitManager({
- activeSplit: vi.fn(),
- getOrchestrator: vi.fn(() => ({})),
- getSplitByContent: vi.fn(),
- openWithSplit,
- } as unknown as SplitManager);
-
- await openEntityInSplitFromUnifiedList(
- {
- type: 'document',
- id: 'doc-1',
- fileType: 'md',
- } as EntityData,
- { splitHandle: controller }
- );
-
- expect(previewSourceEntityId(openWithSplit.mock.calls[0][0])).toBe('doc-1');
- });
-
- it('forwards an explicit preview replacement to the split manager', async () => {
- const openWithSplit = vi.fn();
- const controller = {
- content: () => ({ type: 'component', id: 'inbox' }),
- isControllerSplit: () => true,
- viewerId: () => 'viewer-1',
- } as unknown as SplitHandle;
- setGlobalSplitManager({
- activeSplit: vi.fn(),
- getOrchestrator: vi.fn(() => ({})),
- getSplitByContent: vi.fn(() => ({ id: 'another-split' })),
- openWithSplit,
- } as unknown as SplitManager);
-
- await openEntityInSplitFromUnifiedList(
- {
- type: 'document',
- id: 'doc-1',
- fileType: 'md',
- } as EntityData,
- { splitHandle: controller, replacePreview: true }
- );
-
- expect(openWithSplit.mock.calls[0][1]).toMatchObject({
- replacePreview: true,
- });
- expect(toastAlert).not.toHaveBeenCalled();
- expect(openWithSplit.mock.calls[0][1].preferNewSplit).toBeUndefined();
- // The content takes the pair's place, so it is not preview history.
- expect(
- previewSourceEntityId(openWithSplit.mock.calls[0][0])
- ).toBeUndefined();
- });
});
describe('getChannelEntityTarget', () => {
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index 73fb25e0f9..cd8b602b70 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -22,7 +22,6 @@ import type {
SplitContent,
SplitHandle,
} from '@components/app/split-layout/layoutManager';
-import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
import {
enableCalendarUi,
@@ -48,7 +47,6 @@ import {
type EntityData,
emailQueryKeyExcludesDone,
getSnippetHit,
- isChannelEntity,
isEmailEntity,
isGithubPrEntity,
isHitSnippetEntity,
@@ -100,7 +98,6 @@ import { refreshActiveGraphqlSoupQueries } from '@queries/soup/graphql/active-qu
import { emailClient } from '@service-email/client';
import { isAfter } from 'date-fns';
import { match } from 'ts-pattern';
-import { withPreviewSourceEntityId } from './preview-history';
export { scopeChannelNotificationsForEntity };
@@ -382,11 +379,6 @@ export const restoreSoupFocus = async (entityId?: string): Promise<void> => {
interface OpenEntityOptions {
openInNewSplit?: boolean;
- /**
- * Open in place of the whole Preview Pair: the Viewer closes and the content
- * replaces the Controller. No-op outside a Preview Pair.
- */
- replacePreview?: boolean;
location?: SearchLocation;
splitHandle?: SplitHandle;
mergeHistory?: boolean;
@@ -399,37 +391,6 @@ interface OpenEntityOptions {
notificationSource?: NotificationSource;
}
-const DUPLICATE_CONTENT_MESSAGE = 'Content already open.';
-
-/** Whether this entity is open outside the controller's own preview viewer. */
-export function isDuplicatePreviewEntityOpen(
- entity: EntityData,
- controller: SplitHandle
-): boolean {
- const splitManager = globalSplitManager();
- const viewerId = controller.viewerId();
- if (!splitManager || !viewerId) return false;
-
- const content = getEntitySplitContent(entity);
- const existing = splitManager.getSplitByContent(content.type, content.id);
- return existing !== undefined && existing.id !== viewerId;
-}
-
-/** Show the standard duplicate-content notification. */
-export function notifyDuplicateContentOpen() {
- toast.alert(DUPLICATE_CONTENT_MESSAGE);
-}
-
-/** Reject and notify for an entity already owned by another split. */
-export function preventDuplicatePreviewEntityOpen(
- entity: EntityData,
- controller: SplitHandle
-): boolean {
- if (!isDuplicatePreviewEntityOpen(entity, controller)) return false;
- notifyDuplicateContentOpen();
- return true;
-}
-
/**
* Resolve which channel message to activate when a channel row is opened.
*
@@ -601,13 +562,7 @@ export const openEntityInSplitFromUnifiedList = async (
entity: EntityData,
options: OpenEntityOptions
): Promise<void> => {
- const {
- allowDuplicate,
- openInNewSplit,
- replacePreview,
- splitHandle,
- mergeHistory,
- } = options;
+ const { allowDuplicate, openInNewSplit, splitHandle, mergeHistory } = options;
let { location } = options;
if (!location) {
@@ -621,29 +576,8 @@ export const openEntityInSplitFromUnifiedList = async (
return;
}
- // Channels the viewer hasn't joined can't be read. In a Preview Pair, offer
- // the Join prompt in the Viewer; otherwise the row's inline Join button is
- // the only affordance.
+ // Non-members use the row's inline Join button before opening a channel.
if (isNonMemberChannelEntity(entity)) {
- if (isChannelEntity(entity) && splitHandle?.isControllerSplit()) {
- const joinPromptContent = withPreviewSourceEntityId(
- {
- type: 'component',
- id: 'non-member-channel',
- params: {
- channelId: entity.id,
- channelName: entity.name,
- memberCount: entity.participantIds?.length ?? 0,
- },
- },
- entity.id
- );
- splitManager.openWithSplit(joinPromptContent, {
- referredFrom: options.referredFrom,
- activate: true,
- handle: splitHandle,
- });
- }
return;
}
@@ -655,7 +589,6 @@ export const openEntityInSplitFromUnifiedList = async (
referredFrom: options.referredFrom,
activate: true,
preferNewSplit: openInNewSplit,
- replacePreview,
handle: splitHandle,
mergeHistory,
}
@@ -678,12 +611,7 @@ export const openEntityInSplitFromUnifiedList = async (
'calendar',
CALENDAR_BLOCK_ID
);
- const existingIsViewer =
- existing &&
- splitHandle?.isControllerSplit() &&
- splitHandle.viewerId() === existing.id;
-
- if (existing && !existingIsViewer) {
+ if (existing) {
existing.activate();
} else {
splitManager.openWithSplit(
@@ -692,7 +620,6 @@ export const openEntityInSplitFromUnifiedList = async (
activate: true,
referredFrom: null,
preferNewSplit: openInNewSplit,
- replacePreview,
handle: splitHandle,
mergeHistory,
}
@@ -704,16 +631,6 @@ export const openEntityInSplitFromUnifiedList = async (
const content = getEntitySplitContent(entity);
- if (
- !allowDuplicate &&
- !openInNewSplit &&
- !replacePreview &&
- splitHandle &&
- preventDuplicatePreviewEntityOpen(entity, splitHandle)
- ) {
- return;
- }
-
const channelTarget = getChannelEntityTarget(entity);
const channelMessageTarget =
channelTarget?.kind === 'message' ? channelTarget : undefined;
@@ -750,17 +667,11 @@ export const openEntityInSplitFromUnifiedList = async (
if (splitHandle && referredFrom && isListViewID(referredFrom)) {
splitContent = withListNavigationSource(splitContent, splitHandle);
}
- // Preview source metadata belongs on Viewer entries; a replacement takes the
- // Preview Pair's place, so its entry is ordinary split history.
- if (splitHandle?.isControllerSplit() && !replacePreview) {
- splitContent = withPreviewSourceEntityId(splitContent, entity.id);
- }
splitManager.openWithSplit(splitContent, {
referredFrom,
activate: true,
preferNewSplit: openInNewSplit,
- replacePreview,
handle: splitHandle,
mergeHistory,
allowDuplicate,
diff --git a/apps/web/src/features/notifications/notification-navigation.ts b/apps/web/src/features/notifications/notification-navigation.ts
index 6ae620d912..4fe6d56bd9 100644
--- a/apps/web/src/features/notifications/notification-navigation.ts
+++ b/apps/web/src/features/notifications/notification-navigation.ts
@@ -54,12 +54,7 @@ async function goToLocationInSplit(
await handle?.goToLocationFromParams(params);
}
-/**
- * Opens a split if it is not already open. When `sourceHandle` names the
- * split the navigation originates from and that split is an engaged preview
- * controller, the open is redirected into its viewer split (via the
- * openWithSplit redirect) and never steals the keyboard from the controller.
- */
+/** Opens or activates the requested content from the source split. */
function openSplitIfNotOpen(
layoutManager: SplitManager,
type: BlockName | BlockAlias | 'component',
@@ -72,10 +67,7 @@ function openSplitIfNotOpen(
) {
const existing = layoutManager.getSplitByContent(type, id);
if (existing) {
- const isSourcesViewer =
- options.sourceHandle?.isControllerSplit() &&
- options.sourceHandle.viewerId() === existing.id;
- if (!isSourcesViewer) existing.activate();
+ existing.activate();
} else {
layoutManager.openWithSplit(
{ type, id },
@@ -439,8 +431,7 @@ export function openNotification(
entity?: NotificationEntityOverride,
/**
* The split this navigation originates from (e.g. the list whose row was
- * clicked). Routes the open through that split's preview viewer when its
- * preview mode is engaged.
+ * clicked).
*/
sourceHandle?: SplitHandle
): ResultAsync<void, NotSupportedError> {
diff --git a/apps/web/src/features/soup/createSoupEntityActions.ts b/apps/web/src/features/soup/createSoupEntityActions.ts
index 1d164cd736..e1410456f5 100644
--- a/apps/web/src/features/soup/createSoupEntityActions.ts
+++ b/apps/web/src/features/soup/createSoupEntityActions.ts
@@ -70,7 +70,7 @@ type BuildActionGroups = (
openTagPicker?: () => void;
/**
* The split hosting the list. Open actions route through it so they match
- * their click/hotkey equivalents, including Preview Pair routing.
+ * their click/hotkey equivalents.
*/
splitHandle?: SplitHandle;
/** Creates a view-owned follow-up for action-driven navigation. */
@@ -236,10 +236,7 @@ export function createSoupEntityActions(): {
* The single entity these open actions apply to, if any.
*
* Content already mounted in another split is skipped — reopening it would
- * duplicate it. The Preview Pair's own Viewer is the exception: its copy is
- * the preview of this very row, which opening supersedes rather than
- * duplicates, so the row keeps its open actions while it is being
- * previewed.
+ * duplicate it.
*/
const openableEntity = (): EntityData | undefined => {
if (isMobile()) return undefined;
@@ -257,7 +254,7 @@ export function createSoupEntityActions(): {
'component',
`reminder-view~${entity.id}`
);
- if (open && open.id !== splitHandle?.viewerId()) return undefined;
+ if (open) return undefined;
return entity;
}
const contentId =
@@ -266,34 +263,30 @@ export function createSoupEntityActions(): {
: entity.id;
const contentType = itemToBlockName(entity);
const existing = splitManager.getSplitByContent(contentType, contentId);
- if (existing && existing.id !== splitHandle?.viewerId()) return undefined;
+ if (existing) return undefined;
return entity;
};
- const openEntity =
- (options: { openInNewSplit?: boolean; replacePreview?: boolean }) =>
- async () => {
- const entity = openableEntity();
- if (!entity) return;
+ const openEntity = (options: { openInNewSplit?: boolean }) => async () => {
+ const entity = openableEntity();
+ if (!entity) return;
- if (options.openInNewSplit) {
- analytics.track('split_created', {
- from: 'soup_view_entity_actions_menu',
- });
- }
+ if (options.openInNewSplit) {
+ analytics.track('split_created', {
+ from: 'soup_view_entity_actions_menu',
+ });
+ }
- markReminderSeenOnOpen(entity, notificationSource);
+ markReminderSeenOnOpen(entity, notificationSource);
- // Same path as shift/opt+click, so the menu inherits Preview Pair
- // routing (new split when it fits; replacing the pair outright) and
- // per-entity targeting such as a thread row's driving message.
- await openEntityInSplitFromUnifiedList(entity, {
- ...options,
- splitHandle,
- referredFrom: 'entity-actions-menu',
- notificationSource,
- });
- };
+ // Match row navigation, including a thread row's driving message.
+ await openEntityInSplitFromUnifiedList(entity, {
+ ...options,
+ splitHandle,
+ referredFrom: 'entity-actions-menu',
+ notificationSource,
+ });
+ };
if (openableEntity()) {
topItems.push({
@@ -305,15 +298,6 @@ export function createSoupEntityActions(): {
disabled: !globalSplitManager()?.canAppendSplit(),
onClick: openEntity({ openInNewSplit: true }),
});
-
- if (splitHandle?.isControllerSplit()) {
- topItems.push({
- id: 'open-to-replace-preview',
- label: 'Open to replace preview',
- shortcut: 'opt+enter',
- onClick: openEntity({ replacePreview: true }),
- });
- }
}
// Middle group: Rename, Move to folder, Duplicate, Copy Link, Copy Branch Name, Share
diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
index b31819e561..1d4b60b3af 100644
--- a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
+++ b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
@@ -115,7 +115,6 @@ export function TaskList(props: TaskListProps) {
entity: EntityData,
options: {
openInNewSplit?: boolean;
- replacePreview?: boolean;
mergeHistory?: boolean;
} = {}
) {
@@ -543,8 +542,6 @@ export function TaskList(props: TaskListProps) {
openEntity(project, {
openInNewSplit,
- replacePreview:
- event.altKey && !openInNewSplit,
});
}}
onChecked={(selected, shiftKey) =>
diff --git a/apps/web/src/lib/analytics/app-events.ts b/apps/web/src/lib/analytics/app-events.ts
index 756bcb27ff..f84632144c 100644
--- a/apps/web/src/lib/analytics/app-events.ts
+++ b/apps/web/src/lib/analytics/app-events.ts
@@ -145,7 +145,6 @@ export type AppEvents = {
command_menu_use: { itemType: string };
create_menu_open: { from: string };
hotkey_use: Record<string, unknown>;
- preview_panel_use: Record<string, unknown>;
mentions_menu_use: { itemType: string };
snippets_menu_use: Record<string, unknown>;
split_created: { from: string };
diff --git a/apps/web/src/lib/core/component/Resize/Resize.tsx b/apps/web/src/lib/core/component/Resize/Resize.tsx
index a24b0eeda5..d193af214a 100644
--- a/apps/web/src/lib/core/component/Resize/Resize.tsx
+++ b/apps/web/src/lib/core/component/Resize/Resize.tsx
@@ -110,7 +110,6 @@ function Zone(props: ParentProps<ZoneProps>) {
minSize?: number;
maxSize?: number;
redistributionPreferredSize?: number;
- shareGroup?: string;
}
) {
solver.updatePanel(id, config);
@@ -260,13 +259,6 @@ type PanelProps = {
minSize: number;
maxSize?: number;
redistributionPreferredSize?: number;
- /**
- * Panels sharing a `shareGroup` count as ONE unit for automatic share
- * allocation: an incoming member carves its share out of the group, a
- * departing member returns it, and redistribution-preference deltas settle
- * within the group before touching other panels.
- */
- shareGroup?: string;
/**
* Initial target size for the panel at registration time.
* - number: interpreted as a percentage (e.g., 25 = 25%)
@@ -328,7 +320,6 @@ function Panel(props: ParentProps<PanelProps>) {
minSize: props.minSize,
maxSize: props.maxSize ?? Infinity,
redistributionPreferredSize: props.redistributionPreferredSize,
- shareGroup: props.shareGroup,
target: getTarget(),
});
@@ -349,7 +340,6 @@ function Panel(props: ParentProps<PanelProps>) {
minSize: next.minSize,
maxSize: next.maxSize,
redistributionPreferredSize: next.redistributionPreferredSize,
- shareGroup: next.shareGroup,
});
if (hidden) {
diff --git a/apps/web/src/lib/core/component/Resize/solver.test.ts b/apps/web/src/lib/core/component/Resize/solver.test.ts
index 11d9df97de..70d22e992d 100644
--- a/apps/web/src/lib/core/component/Resize/solver.test.ts
+++ b/apps/web/src/lib/core/component/Resize/solver.test.ts
@@ -30,30 +30,6 @@ describe('createResizeSolver', () => {
dispose();
});
-
- it('moves all contiguous members of a share group together', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1000,
- panels: [],
- }),
- }));
-
- solver.addPanel({ id: 'A', minSize: 0 });
- solver.addPanel({ id: 'B', minSize: 0, shareGroup: 'pair' });
- solver.addPanel({ id: 'C', minSize: 0, shareGroup: 'pair' });
- solver.addPanel({ id: 'D', minSize: 0 });
- await Promise.resolve();
-
- solver.swap('B', 'D');
-
- expect(solver.order()).toEqual(['A', 'D', 'B', 'C']);
-
- dispose();
- });
});
describe('addPanel', () => {
@@ -149,14 +125,14 @@ describe('createResizeSolver', () => {
await Promise.resolve();
- solver.addPanel({ id: 'controller', minSize: 100 });
- solver.updatePanel('controller', {
+ solver.addPanel({ id: 'sidebar', minSize: 100 });
+ solver.updatePanel('sidebar', {
redistributionPreferredSize: 440,
});
- expect(solver.solve().sizes.get('controller')).toBe(1600);
+ expect(solver.solve().sizes.get('sidebar')).toBe(1600);
- solver.addPanel({ id: 'viewer', minSize: 100 });
- expect(solver.solve().sizes.get('controller')).toBe(440);
+ solver.addPanel({ id: 'content', minSize: 100 });
+ expect(solver.solve().sizes.get('sidebar')).toBe(440);
dispose();
});
@@ -175,18 +151,18 @@ describe('createResizeSolver', () => {
// createEffect performs its initial solve after the root body.
await Promise.resolve();
- solver.addPanel({ id: 'controller', minSize: 100 });
- solver.addPanel({ id: 'viewer', minSize: 100 });
+ solver.addPanel({ id: 'sidebar', minSize: 100 });
+ solver.addPanel({ id: 'content', minSize: 100 });
solver.addPanel({ id: 'adjacent', minSize: 100 });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
+ solver.updatePanel('sidebar', { redistributionPreferredSize: 440 });
- expect(solver.solve().sizes.get('controller')).toBe(440);
+ expect(solver.solve().sizes.get('sidebar')).toBe(440);
solver.moveHandle(0, 160);
- expect(solver.solve().sizes.get('controller')).toBe(600);
+ expect(solver.solve().sizes.get('sidebar')).toBe(600);
solver.dropPanel('adjacent');
- expect(solver.solve().sizes.get('controller')).toBe(440);
+ expect(solver.solve().sizes.get('sidebar')).toBe(440);
dispose();
});
@@ -204,16 +180,16 @@ describe('createResizeSolver', () => {
await Promise.resolve();
- solver.addPanel({ id: 'controller', minSize: 400 });
- solver.updatePanel('controller', {
+ solver.addPanel({ id: 'sidebar', minSize: 400 });
+ solver.updatePanel('sidebar', {
redistributionPreferredSize: 1200,
});
- solver.addPanel({ id: 'viewer', minSize: 400 });
+ solver.addPanel({ id: 'content', minSize: 400 });
- expect(solver.solve().sizes.get('controller')).toBe(1200);
+ expect(solver.solve().sizes.get('sidebar')).toBe(1200);
solver.moveHandle(0, 100);
- expect(solver.solve().sizes.get('controller')).toBe(1300);
+ expect(solver.solve().sizes.get('sidebar')).toBe(1300);
dispose();
});
@@ -231,383 +207,14 @@ describe('createResizeSolver', () => {
await Promise.resolve();
- solver.addPanel({ id: 'controller', minSize: 400 });
- solver.updatePanel('controller', {
+ solver.addPanel({ id: 'sidebar', minSize: 400 });
+ solver.updatePanel('sidebar', {
redistributionPreferredSize: 1200,
});
- solver.addPanel({ id: 'viewer', minSize: 400 });
-
- expect(solver.solve().sizes.get('controller')).toBe(1192);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
-
- dispose();
- });
- });
-
- describe('shareGroup', () => {
- it('carves a joining member share from its group, leaving other units alone', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- expect(solver.solve().sizes.get('doc')).toBe(800);
-
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(400);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
-
- dispose();
- });
-
- it('returns a departing member share to its group', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
-
- solver.dropPanel('viewer');
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(800);
-
- dispose();
- });
-
- it('counts a group as one unit when a standalone panel is added', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'doc', minSize: 100 });
-
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(400);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
-
- dispose();
- });
-
- it('settles a redistribution preference within the group', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
-
- // The pin trades space with the viewer; the document keeps 50%.
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(440);
- expect(solver.solve().sizes.get('viewer')).toBe(360);
-
- dispose();
- });
-
- it('yields the pin to its unit budget when group-mates cannot fund it', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 400 });
- solver.addPanel({ id: 'controller', minSize: 400, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 400, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
-
- // The viewer sits at its minimum, so the pair cannot fund the pin:
- // it shrinks back to the unit's budget instead of taking from the
- // document.
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(400);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
-
- dispose();
- });
-
- it('keeps singles at equal unit shares when a split is added beside a pair', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'L', minSize: 400 });
- solver.addPanel({ id: 'controller', minSize: 340, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 400, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
-
- // "New split right": three units intend a third each. The zone is too
- // tight to honor that (the pair's hard minimums are 340 + 400), but
- // the singles stay EQUAL and the pair only exceeds a third by its
- // minimums — the unfunded pin may not push the singles further down.
- solver.addPanel({ id: 'new', minSize: 400 });
- expect(solver.solve().sizes.get('L')).toBe(430);
- expect(solver.solve().sizes.get('new')).toBe(430);
- expect(solver.solve().sizes.get('controller')).toBe(340);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
-
- dispose();
- });
-
- it('absorbs the group gutter so other panels never shift on join/leave', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 8,
- size: () => 1608,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- expect(solver.solve().sizes.get('doc')).toBe(800);
-
- // The viewer's gutter comes out of the pair, not the other panels.
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(396);
- expect(solver.solve().sizes.get('viewer')).toBe(396);
-
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(440);
- expect(solver.solve().sizes.get('viewer')).toBe(352);
-
- // Disengage clears the preference alongside the drop (in the app both
- // land in one reactive flush); leaving then reclaims the gutter for
- // an exact round-trip.
- solver.updatePanel('controller', {
- redistributionPreferredSize: undefined,
- });
- expect(solver.solve().sizes.get('doc')).toBe(800);
- solver.dropPanel('viewer');
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(800);
-
- dispose();
- });
-
- it('keeps unit shares stable across zone resizes', async () => {
- const [size, setSize] = createSignal(1600);
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
-
- expect(solver.solve().sizes.get('doc')).toBe(800);
-
- // Growing the zone keeps the document at half; the pinned controller
- // stays put and its group-mate absorbs the pair's growth.
- setSize(2000);
- expect(solver.solve().sizes.get('doc')).toBe(1000);
- expect(solver.solve().sizes.get('controller')).toBe(440);
- expect(solver.solve().sizes.get('viewer')).toBe(560);
-
- dispose();
- });
-
- it('routes gutter-drag growth past the controller preferred size to the viewer', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
- expect(solver.solve().sizes.get('doc')).toBe(800);
-
- // Shrinking the document leaves the controller at its preferred
- // width; the freed space flows to the viewer.
- solver.moveHandle(0, -200);
- expect(solver.solve().sizes.get('doc')).toBe(600);
- expect(solver.solve().sizes.get('controller')).toBe(440);
- expect(solver.solve().sizes.get('viewer')).toBe(560);
-
- // Dragging the pair's own internal gutter still resizes the
- // controller directly.
- solver.moveHandle(1, 100);
- expect(solver.solve().sizes.get('controller')).toBe(540);
- expect(solver.solve().sizes.get('viewer')).toBe(460);
-
- dispose();
- });
-
- it('takes gutter-drag shrink from the viewer before the controller', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
- solver.updatePanel('controller', { redistributionPreferredSize: 440 });
-
- // Growing the document squeezes the viewer while the controller
- // holds its preferred width...
- solver.moveHandle(0, 200);
- expect(solver.solve().sizes.get('doc')).toBe(1000);
- expect(solver.solve().sizes.get('controller')).toBe(440);
- expect(solver.solve().sizes.get('viewer')).toBe(160);
-
- // ...and only once the viewer bottoms out does the controller give.
- solver.moveHandle(0, 200);
- expect(solver.solve().sizes.get('doc')).toBe(1200);
- expect(solver.solve().sizes.get('controller')).toBe(300);
- expect(solver.solve().sizes.get('viewer')).toBe(100);
-
- dispose();
- });
-
- it('restores per-unit distribution when a split closes from a min-crushed layout', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 8,
- size: () => 1704,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- // [L | pair(C+V) | R] in a zone where the pair's floor (440 + 400)
- // forces everything else onto its minimums.
- solver.addPanel({ id: 'L', minSize: 400 });
- solver.addPanel({ id: 'C', minSize: 340, shareGroup: 'pair' });
- solver.updatePanel('C', { redistributionPreferredSize: 440 });
- solver.addPanel({ id: 'V', minSize: 400, shareGroup: 'pair' });
- solver.addPanel({ id: 'R', minSize: 400 });
-
- // Rendering is constraint-dictated: L is crushed below its intent by
- // the pair's hard minimums (the unfunded pin has already yielded).
- expect(solver.solve().sizes.get('L')).toBe(471);
- expect(solver.solve().sizes.get('C')).toBe(340);
- expect(solver.solve().sizes.get('V')).toBe(400);
- expect(solver.solve().sizes.get('R')).toBe(469);
-
- // Closing R must distribute per UNIT: the crushed pixels carry no
- // intent, so L returns to half the zone and the pair takes the other
- // half — not two-thirds to the pair's two panels.
- solver.dropPanel('R');
- expect(solver.solve().sizes.get('L')).toBe(848);
- expect(solver.solve().sizes.get('C')).toBe(440);
- expect(solver.solve().sizes.get('V')).toBe(400);
-
- dispose();
- });
-
- it('resets to an equal share per unit', async () => {
- const { solver, dispose } = createRoot((dispose) => ({
- dispose,
- solver: createResizeSolver({
- direction: 'horizontal',
- gutter: () => 0,
- size: () => 1600,
- panels: [],
- }),
- }));
-
- await Promise.resolve();
-
- solver.addPanel({ id: 'doc', minSize: 100 });
- solver.addPanel({ id: 'controller', minSize: 100, shareGroup: 'pair' });
- solver.addPanel({ id: 'viewer', minSize: 100, shareGroup: 'pair' });
-
- solver.moveHandle(0, -400);
- expect(solver.solve().sizes.get('doc')).toBe(400);
+ solver.addPanel({ id: 'content', minSize: 400 });
- solver.reset();
- expect(solver.solve().sizes.get('doc')).toBe(800);
- expect(solver.solve().sizes.get('controller')).toBe(400);
- expect(solver.solve().sizes.get('viewer')).toBe(400);
+ expect(solver.solve().sizes.get('sidebar')).toBe(1192);
+ expect(solver.solve().sizes.get('content')).toBe(400);
dispose();
});
diff --git a/apps/web/src/lib/core/component/Resize/solver.ts b/apps/web/src/lib/core/component/Resize/solver.ts
index 461ed574f8..d7807e31c8 100644
--- a/apps/web/src/lib/core/component/Resize/solver.ts
+++ b/apps/web/src/lib/core/component/Resize/solver.ts
@@ -18,7 +18,6 @@ type ResizeSolver = {
minSize?: number;
maxSize?: number;
redistributionPreferredSize?: number;
- shareGroup?: string;
}
) => void;
solve: () => LayoutResult;
@@ -170,25 +169,6 @@ function initPanel(panel: PanelConfig): Panel {
};
}
-/**
- * Panels with the same `shareGroup` form one layout unit; every ungrouped
- * panel is a unit of its own. Automatic share allocation is per unit, so a
- * group collectively receives the space a single panel would.
- */
-function countUnits(panels: readonly Pick<Panel, 'shareGroup'>[]): number {
- const groups = new Set<string>();
- let units = 0;
- for (const panel of panels) {
- if (panel.shareGroup === undefined) {
- units += 1;
- } else if (!groups.has(panel.shareGroup)) {
- groups.add(panel.shareGroup);
- units += 1;
- }
- }
- return units;
-}
-
/**
* Pin automatic-layout preferences when the remaining panels can absorb the
* leftover space. Preferences yield to every panel's minimum size, while
@@ -238,66 +218,6 @@ function applyRedistributionPreferences(
// Avoid leaving a gap when no other panel can absorb the remaining space.
if (resolvedPreferredTotal + remainingMax + EPSILON < usable) return panels;
- // Settle a pinned panel's size delta within its share group first: the
- // group is one layout unit, so pinning one member trades space with its
- // group-mates and leaves the other units' sizes alone. Whatever the
- // group-mates cannot fund shrinks the pin itself (down to the panel's
- // hard minimum) instead of taking space from other units. Hard minimums
- // always still leak to the global solve.
- const shareAdjustments = new Map<PanelId, number>();
- const adjustedShare = (panel: Panel) =>
- panel.share + (shareAdjustments.get(panel.id) ?? 0);
- for (const entry of preferredPanels) {
- const { panel, size } = entry;
- if (panel.shareGroup === undefined) continue;
- const groupMates = panels.filter(
- (candidate) =>
- candidate.shareGroup === panel.shareGroup &&
- candidate.id !== panel.id &&
- !preferredIds.has(candidate.id)
- );
- if (groupMates.length === 0) continue;
-
- const delta = size / usable - panel.share;
- if (delta > EPSILON) {
- // The pin grows the panel: group-mates give up share, weighted by
- // their room above minimum.
- const capacities = groupMates.map((mate) =>
- Math.max(0, adjustedShare(mate) - mate.minSize / usable)
- );
- const totalCapacity = sumArray(capacities);
- const applied = Math.min(delta, totalCapacity);
- if (totalCapacity > 0 && applied > 0) {
- groupMates.forEach((mate, i) => {
- const give = applied * (capacities[i] / totalCapacity);
- shareAdjustments.set(
- mate.id,
- (shareAdjustments.get(mate.id) ?? 0) - give
- );
- });
- }
- const unfunded = delta - applied;
- if (unfunded > EPSILON) {
- entry.size = Math.max(panel.minSize, (panel.share + applied) * usable);
- }
- } else if (delta < -EPSILON) {
- // The pin shrinks the panel: group-mates receive the freed share,
- // weighted by their current shares.
- const weights = groupMates.map((mate) =>
- Math.max(0, adjustedShare(mate))
- );
- const totalWeight = sumArray(weights);
- groupMates.forEach((mate, i) => {
- const weight =
- totalWeight > 0 ? weights[i] / totalWeight : 1 / groupMates.length;
- shareAdjustments.set(
- mate.id,
- (shareAdjustments.get(mate.id) ?? 0) + -delta * weight
- );
- });
- }
- }
-
const preferredSizeById = new Map(
preferredPanels.map(({ panel, size }) => [panel.id, size])
);
@@ -311,10 +231,7 @@ function applyRedistributionPreferences(
share: preferred / usable,
};
}
- const adjustment = shareAdjustments.get(panel.id);
- return adjustment === undefined
- ? panel
- : { ...panel, share: Math.max(0, panel.share + adjustment) };
+ return panel;
});
}
@@ -378,8 +295,7 @@ export function createResizeSolver(params: {
// manual gutter drags write them. A solve renders intent under the current
// constraints (minimums, pins) but NEVER writes the result back — solved
// pixels in a tight zone are constraint-dictated and carry no intent, and
- // baking them in would permanently distort the model (e.g. a min-crushed
- // Preview Pair would keep its crushed proportions after space frees up).
+ // baking them in would preserve cramped proportions after space frees up.
createEffect(() => {
const ps = panelsInOrder();
const zoneSize = params.size();
@@ -415,63 +331,8 @@ export function createResizeSolver(params: {
const usableSize = getUsable(nextLength, params.size(), params.gutter());
- // A panel joining a live share group carves its share out of the
- // group's members: the group is one layout unit, so the other units
- // keep their sizes. The group also absorbs the gutter the new panel
- // introduces — usable space shrinks by one gutter, so without the
- // correction every other panel would shift by its slice of it.
- const groupMemberIds =
- panel.shareGroup === undefined
- ? []
- : ids.filter((id) => panelData[id].shareGroup === panel.shareGroup);
- if (groupMemberIds.length > 0) {
- const memberIdSet = new Set(groupMemberIds);
- const groupShare = sumArray(
- groupMemberIds.map((id) => panelData[id].share)
- );
- const usableBefore = getUsable(length, params.size(), params.gutter());
- const memberScale = groupMemberIds.length / (groupMemberIds.length + 1);
- let incomingGroupShare = groupShare;
- if (usableBefore > 0 && usableSize > 0) {
- const nextGroupShare = Math.max(
- 0,
- (groupShare * usableBefore - params.gutter()) / usableSize
- );
- const rescale = usableBefore / usableSize;
- const groupRescale = groupShare > 0 ? nextGroupShare / groupShare : 0;
- for (const id of ids) {
- panelData[id].share *= memberIdSet.has(id)
- ? groupRescale * memberScale
- : rescale;
- }
- incomingGroupShare = nextGroupShare;
- } else {
- // Zone size unknown: fall back to a plain within-group carve.
- for (const id of groupMemberIds) {
- panelData[id].share *= memberScale;
- }
- }
- panelData[panel.id] = {
- ...initPanel(panel),
- share: incomingGroupShare / (groupMemberIds.length + 1),
- };
-
- if (index >= order().length) {
- setOrder((prev) => [...prev, panel.id]);
- } else {
- setOrder((prev) => [
- ...prev.slice(0, index),
- panel.id,
- ...prev.slice(index),
- ]);
- }
- setDirty();
- return;
- }
-
- // Calculate incoming share based on target spec, defaulting to an
- // equal share per layout unit (a share group counts as one unit).
- let incomingShare = 1 / (countUnits(ids.map((id) => panelData[id])) + 1);
+ // Calculate the incoming share from its target, defaulting to equal shares.
+ let incomingShare = 1 / nextLength;
if (panel.target && usableSize > 0) {
switch (panel.target.kind) {
@@ -529,7 +390,6 @@ export function createResizeSolver(params: {
minSize?: number;
maxSize?: number;
redistributionPreferredSize?: number;
- shareGroup?: string;
}
) {
const panel = panelData[id];
@@ -556,11 +416,6 @@ export function createResizeSolver(params: {
changed = true;
}
}
- if ('shareGroup' in config) {
- // Membership alone moves no pixels, so it does not dirty the layout;
- // it only informs future share allocation.
- panel.shareGroup = config.shareGroup;
- }
if (changed) setDirty();
}
@@ -572,57 +427,6 @@ export function createResizeSolver(params: {
const nextLength = nextIds.length;
if (length === nextLength) return;
- // A departing group member leaves its share to the rest of its group,
- // so the group keeps its overall size and other units are unaffected.
- // The group also reclaims the gutter the departing panel frees —
- // mirroring the join-time absorption — so other panels' pixel widths
- // survive an engage/disengage round-trip exactly. The proportional
- // renormalization below then only fixes drift.
- const dropped = panelData[id];
- const groupMemberIds =
- dropped?.shareGroup === undefined
- ? []
- : nextIds.filter(
- (x) => panelData[x]?.shareGroup === dropped.shareGroup
- );
- if (groupMemberIds.length > 0 && dropped.share > 0) {
- const memberSum = sumArray(
- groupMemberIds.map((x) => panelData[x].share)
- );
- const usableBefore = getUsable(length, params.size(), params.gutter());
- const usableAfter = getUsable(
- nextLength,
- params.size(),
- params.gutter()
- );
- if (usableBefore > 0 && usableAfter > 0) {
- const groupShare = memberSum + dropped.share;
- const nextGroupShare =
- (groupShare * usableBefore + params.gutter()) / usableAfter;
- const rescale = usableBefore / usableAfter;
- const memberIdSet = new Set(groupMemberIds);
- for (const x of nextIds) {
- if (!memberIdSet.has(x)) panelData[x].share *= rescale;
- }
- for (const x of groupMemberIds) {
- const weight =
- memberSum > 0
- ? panelData[x].share / memberSum
- : 1 / groupMemberIds.length;
- panelData[x].share = nextGroupShare * weight;
- }
- } else {
- // Zone size unknown: fall back to a plain within-group hand-off.
- for (const x of groupMemberIds) {
- const weight =
- memberSum > 0
- ? panelData[x].share / memberSum
- : 1 / groupMemberIds.length;
- panelData[x].share += dropped.share * weight;
- }
- }
- }
-
const sum = sumArray(
nextIds.map((id) => untrack(() => panelData[id]?.share ?? 0))
);
@@ -688,89 +492,7 @@ export function createResizeSolver(params: {
return Math.max(0, maxS - shares[i]);
};
- /**
- * The preferred share a grouped panel soft-pins to during gutter drags,
- * or undefined for panels without one.
- */
- const preferredShare = (i: number): number | undefined => {
- const panel = panels[i];
- const preferred = panel.redistributionPreferredSize;
- if (
- panel.shareGroup === undefined ||
- preferred === undefined ||
- !Number.isFinite(preferred)
- ) {
- return undefined;
- }
- const px = Math.min(Math.max(preferred, panel.minSize), panel.maxSize);
- return px / usable;
- };
-
- /** Contiguous group-mates of panel `i`, walking in direction `dir`. */
- const matesBeyond = (i: number, dir: 1 | -1): number[] => {
- const group = panels[i].shareGroup;
- if (group === undefined) return [];
- const mates: number[] = [];
- for (
- let j = i + dir;
- j >= 0 && j < n && panels[j].shareGroup === group;
- j += dir
- ) {
- mates.push(j);
- }
- return mates;
- };
-
- /**
- * Grow capacity of the handle's neighbor, including group-mates behind
- * it when growth cascades past a preferred size (see growFrom).
- */
- const growCapFrom = (i: number, dir: 1 | -1) => {
- const mates = preferredShare(i) === undefined ? [] : matesBeyond(i, dir);
- return growCap(i) + sumArray(mates.map(growCap));
- };
-
- /**
- * Grow the handle's neighbor `i` by `amount`. A grouped panel with a
- * preferred size (a preview Controller) soft-caps at that preferred size: overflow flows
- * to its group-mates beyond it (its Viewer) rather than growing it past
- * its configured width. Dragging the group's own internal gutter is
- * unaffected — there the mates sit on the handle side, so the neighbor
- * grows directly.
- */
- const growFrom = (
- newShares: number[],
- i: number,
- dir: 1 | -1,
- amount: number
- ) => {
- const preferred = preferredShare(i);
- const mates = preferred === undefined ? [] : matesBeyond(i, dir);
- if (preferred === undefined || mates.length === 0) {
- newShares[i] += amount;
- return;
- }
- const softCap = Math.max(preferred, newShares[i]);
- const direct = Math.min(amount, Math.max(0, softCap - newShares[i]));
- newShares[i] += direct;
- let remain = amount - direct;
- for (const j of mates) {
- if (remain <= EPSILON) break;
- const [, maxS] = bounds(j);
- const take = Math.min(remain, Math.max(0, maxS - newShares[j]));
- newShares[j] += take;
- remain -= take;
- }
- // Group-mates saturated: the rest lands on the neighbor after all.
- newShares[i] += remain;
- };
-
- /**
- * Shrink the stack starting at `from`, walking away from the handle.
- * Grouped panels with a preferred size hold it while their elastic
- * group-mates give space (pass 1); only when the whole stack is
- * otherwise exhausted do they shrink below it to their minimum (pass 2).
- */
+ // Shrink panels outward from the handle until the requested space is freed.
const shrinkStack = (
newShares: number[],
from: number,
@@ -778,17 +500,6 @@ export function createResizeSolver(params: {
amount: number
) => {
let remain = amount;
- for (let i = from; i >= 0 && i < n && remain > EPSILON; i += dir) {
- const [minS] = bounds(i);
- const preferred = preferredShare(i);
- const floor =
- preferred === undefined
- ? minS
- : Math.max(minS, Math.min(preferred, newShares[i]));
- const take = Math.min(Math.max(0, newShares[i] - floor), remain);
- newShares[i] -= take;
- remain -= take;
- }
for (let i = from; i >= 0 && i < n && remain > EPSILON; i += dir) {
const [minS] = bounds(i);
const take = Math.min(Math.max(0, newShares[i] - minS), remain);
@@ -819,14 +530,14 @@ export function createResizeSolver(params: {
// Move LEFT: shrink LEFT stack, grow RIGHT
const req = -dShare;
const capShrinkLeft = shrinkCapLeftStack();
- const capGrowR = growCapFrom(R, 1);
+ const capGrowR = growCap(R);
const applied = Math.min(req, capShrinkLeft, capGrowR);
if (applied <= 0) return;
const newShares = shares.slice();
// shrink from the handle outward: L, L-1, L-2, ...
shrinkStack(newShares, L, -1, applied);
- growFrom(newShares, R, 1, applied);
+ newShares[R] += applied;
for (let i = 0; i < n; i++) {
panelData[ids[i]].share = newShares[i];
@@ -835,13 +546,13 @@ export function createResizeSolver(params: {
// dShare > 0: Move RIGHT: shrink RIGHT stack, grow LEFT
const req = dShare;
const capShrinkRight = shrinkCapRightStack();
- const capGrowL = growCapFrom(L, -1);
+ const capGrowL = growCap(L);
const applied = Math.min(req, capShrinkRight, capGrowL);
if (applied <= 0) return;
const newShares = shares.slice();
shrinkStack(newShares, R, 1, applied);
- growFrom(newShares, L, -1, applied);
+ newShares[L] += applied;
for (let i = 0; i < n; i++) {
panelData[ids[i]].share = newShares[i];
@@ -866,40 +577,7 @@ export function createResizeSolver(params: {
const secondIndex = ids.indexOf(secondId);
if (firstIndex < 0 || secondIndex < 0) return;
- const groupBounds = (index: number) => {
- const group = panelData[ids[index]]?.shareGroup;
- if (group === undefined) return [index, index] as const;
-
- let start = index;
- let end = index;
- while (start > 0 && panelData[ids[start - 1]]?.shareGroup === group) {
- start -= 1;
- }
- while (
- end < ids.length - 1 &&
- panelData[ids[end + 1]]?.shareGroup === group
- ) {
- end += 1;
- }
- return [start, end] as const;
- };
-
- const [firstStart, firstEnd] = groupBounds(firstIndex);
- const [secondStart, secondEnd] = groupBounds(secondIndex);
- if (firstStart === secondStart) return;
-
- const [leftStart, leftEnd, rightStart, rightEnd] =
- firstStart < secondStart
- ? [firstStart, firstEnd, secondStart, secondEnd]
- : [secondStart, secondEnd, firstStart, firstEnd];
- const nextIds = [
- ...ids.slice(0, leftStart),
- ...ids.slice(rightStart, rightEnd + 1),
- ...ids.slice(leftEnd + 1, rightStart),
- ...ids.slice(leftStart, leftEnd + 1),
- ...ids.slice(rightEnd + 1),
- ];
- setOrder(nextIds);
+ setOrder(ids.with(firstIndex, secondId).with(secondIndex, firstId));
}
return {
@@ -910,23 +588,9 @@ export function createResizeSolver(params: {
solve: layout,
reset: () => {
const panels = panelsInOrder();
- const units = countUnits(panels);
- if (units === 0) return;
- const groupSizes = new Map<string, number>();
- for (const panel of panels) {
- if (panel.shareGroup !== undefined) {
- groupSizes.set(
- panel.shareGroup,
- (groupSizes.get(panel.shareGroup) ?? 0) + 1
- );
- }
- }
- // Equal share per unit; group members split their unit's share.
+ if (panels.length === 0) return;
for (const panel of panels) {
- panelData[panel.id].share =
- panel.shareGroup === undefined
- ? 1 / units
- : 1 / units / groupSizes.get(panel.shareGroup)!;
+ panelData[panel.id].share = 1 / panels.length;
}
setDirty();
},
diff --git a/apps/web/src/lib/core/component/Resize/types.ts b/apps/web/src/lib/core/component/Resize/types.ts
index 203c438582..64e476a670 100644
--- a/apps/web/src/lib/core/component/Resize/types.ts
+++ b/apps/web/src/lib/core/component/Resize/types.ts
@@ -18,8 +18,6 @@ export type Panel = {
minSize: number;
maxSize: number;
redistributionPreferredSize?: number;
- /** Panels with the same key form one layout unit for automatic sizing. */
- shareGroup?: string;
share: number;
target: PanelSizeSpec;
};
@@ -29,7 +27,6 @@ export type PanelConfig = {
minSize?: number;
maxSize?: number;
redistributionPreferredSize?: number;
- shareGroup?: string;
target?: PanelSizeSpec;
};
@@ -49,7 +46,6 @@ export type ResizeZoneCtx = {
minSize?: number;
maxSize?: number;
redistributionPreferredSize?: number;
- shareGroup?: string;
}
) => void;
gutterSize: () => number;
diff --git a/apps/web/src/lib/core/constant/SettingsState.tsx b/apps/web/src/lib/core/constant/SettingsState.tsx
index b0750d3288..3f9fee4f2e 100644
--- a/apps/web/src/lib/core/constant/SettingsState.tsx
+++ b/apps/web/src/lib/core/constant/SettingsState.tsx
@@ -41,8 +41,7 @@ export type SettingsTab =
// Where "Back to app" (and move-to-split) should return to: the layout the user
// was on when they opened settings. A full base-relative URL — path plus query
-// and hash — so layout state carried outside the path (notably the `preview`
-// param encoding Controller/Viewer Preview Pairs) survives the round trip.
+// and hash — so content locations survive the round trip.
// Undefined when settings was deep-linked, in which case we fall back to
// DEFAULT_ROUTE.
const [settingsReturnTo, setSettingsReturnTo] = createSignal<string>();
@@ -131,9 +130,8 @@ export const useSettingsState = () => {
// Capture the current layout (minus any settings split) as where "Back to
// app"/"Move to split" should return to, then clobber every other split so
// settings becomes the sole one. Shared by opening settings fresh and by
- // collapsing a docked-alongside layout back down to solo. The query and hash
- // are captured too: the `preview` param is what links Controller/Viewer
- // Preview Pairs, so returning to the path alone would sever them.
+ // collapsing a docked-alongside layout back down to solo. Capture query and
+ // hash too so content locations are restored.
const collapseToSoloSettings = (tab: SettingsTab) => {
setSettingsReturnTo(
stripSettingsSplitFromUrl(
@@ -222,9 +220,7 @@ export const useSettingsState = () => {
// Strip any settings split already in the target layout before re-adding
// one, so repeatedly toggling fullscreen ⇄ split reuses a single settings
// split (on the current tab) instead of stacking a new one each cycle.
- // The return layout's query/hash ride along — appending settings at the
- // end keeps `preview` indices valid — so its Preview Pairs re-link when
- // the URL sync rebuilds the layout.
+ // Preserve the return layout's query and hash when appending settings.
const returnTo = stripSettingsSplitFromUrl(
settingsReturnTo() ?? DEFAULT_ROUTE
);
diff --git a/apps/web/src/lib/core/constant/settingsSplitUrl.test.ts b/apps/web/src/lib/core/constant/settingsSplitUrl.test.ts
index f33377128d..327beced2e 100644
--- a/apps/web/src/lib/core/constant/settingsSplitUrl.test.ts
+++ b/apps/web/src/lib/core/constant/settingsSplitUrl.test.ts
@@ -1,53 +1,23 @@
import { DEFAULT_ROUTE } from '@app/constants/defaultRoute';
-import { describe, expect, it, vi } from 'vitest';
+import { describe, expect, it } from 'vitest';
import {
appendSettingsSplitToUrl,
stripSettingsSplitFromUrl,
} from './settingsSplitUrl';
-// The preview-persistence import chain reaches the block registry, whose
-// eager definition glob drags in every block feature; the URL helpers only
-// need alias resolution to exist.
-vi.mock('@core/constant/allBlocks', () => ({
- isBlockAlias: vi.fn(() => false),
- resolveBlockAlias: vi.fn((type: string) => type),
-}));
-
describe('stripSettingsSplitFromUrl', () => {
it('returns a URL without a settings split unchanged', () => {
expect(
- stripSettingsSplitFromUrl('/component/mail/email/e-1?preview=0#sel')
- ).toBe('/component/mail/email/e-1?preview=0#sel');
+ stripSettingsSplitFromUrl('/component/mail/email/e-1?filter=all#sel')
+ ).toBe('/component/mail/email/e-1?filter=all#sel');
});
it('strips a trailing settings split, preserving query and hash', () => {
expect(
stripSettingsSplitFromUrl(
- '/component/mail/email/e-1/settings/account?preview=0#sel'
- )
- ).toBe('/component/mail/email/e-1?preview=0#sel');
- });
-
- it('remaps Preview Pair indices past a stripped settings split', () => {
- expect(
- stripSettingsSplitFromUrl(
- '/settings/account/component/mail/md/doc-1?preview=1'
- )
- ).toBe('/component/mail/md/doc-1?preview=0');
- });
-
- it('drops a Preview Pair that referenced the settings split', () => {
- expect(
- stripSettingsSplitFromUrl('/component/mail/settings/account?preview=0')
- ).toBe('/component/mail');
- });
-
- it('keeps unrelated query params while remapping the preview param', () => {
- expect(
- stripSettingsSplitFromUrl(
- '/settings/account/component/mail/md/doc-1?keep=value&preview=1'
+ '/component/mail/email/e-1/settings/account?filter=all#sel'
)
- ).toBe('/component/mail/md/doc-1?keep=value&preview=0');
+ ).toBe('/component/mail/email/e-1?filter=all#sel');
});
it('strips the legacy component/settings form', () => {
@@ -69,10 +39,10 @@ describe('appendSettingsSplitToUrl', () => {
it('appends the settings split before the query and hash', () => {
expect(
appendSettingsSplitToUrl(
- '/component/mail/email/e-1?preview=0#sel',
+ '/component/mail/email/e-1?filter=all#sel',
'account'
)
- ).toBe('/component/mail/email/e-1/settings/account?preview=0#sel');
+ ).toBe('/component/mail/email/e-1/settings/account?filter=all#sel');
});
it('handles a trailing slash on the base path', () => {
diff --git a/apps/web/src/lib/core/constant/settingsSplitUrl.ts b/apps/web/src/lib/core/constant/settingsSplitUrl.ts
index 6b74218598..985376dd95 100644
--- a/apps/web/src/lib/core/constant/settingsSplitUrl.ts
+++ b/apps/web/src/lib/core/constant/settingsSplitUrl.ts
@@ -1,8 +1,4 @@
import { DEFAULT_ROUTE } from '@app/constants/defaultRoute';
-import {
- PREVIEW_QUERY_PARAM,
- remapPreviewQueryForRemovedSplit,
-} from '@components/app/split-layout/previewPersistence';
/**
* Parse a base-relative app URL. The base only anchors parsing — inputs come
@@ -21,25 +17,19 @@ const toRelativeUrl = (url: URL) => `${url.pathname}${url.search}${url.hash}`;
* inspected so a block id that happens to be "settings" isn't mistaken for
* one.
*
- * The query string and hash are preserved. Removing a split shifts the URL
- * pair indices after it, so Preview Pairs declared in the `preview` query
- * param are remapped to keep pointing at the same splits (a pair that
- * referenced the settings split itself is dropped). When settings was the
- * only split there is no layout left to return to, so the default route is
- * returned bare.
+ * The query string and hash are preserved. If settings was the only split,
+ * return the default route.
*/
export const stripSettingsSplitFromUrl = (urlString: string): string => {
const url = parseUrl(urlString);
const segments = url.pathname.split('/').filter(Boolean);
- let removedSplitIndex: number | undefined;
for (let i = 0; i + 1 < segments.length; i += 2) {
const type = segments[i];
if (
type === 'settings' ||
(type === 'component' && segments[i + 1] === 'settings')
) {
- removedSplitIndex = i / 2;
segments.splice(i, 2);
break;
}
@@ -47,27 +37,13 @@ export const stripSettingsSplitFromUrl = (urlString: string): string => {
if (segments.length === 0) return DEFAULT_ROUTE;
- if (removedSplitIndex !== undefined) {
- const remappedPreview = remapPreviewQueryForRemovedSplit(
- url.searchParams.get(PREVIEW_QUERY_PARAM) ?? undefined,
- removedSplitIndex
- );
- if (remappedPreview === undefined) {
- url.searchParams.delete(PREVIEW_QUERY_PARAM);
- } else {
- url.searchParams.set(PREVIEW_QUERY_PARAM, remappedPreview);
- }
- }
-
url.pathname = `/${segments.join('/')}`;
return toRelativeUrl(url);
};
/**
* Append a docked settings split (`settings/<slug>`) to a base-relative
- * split-layout URL, keeping its query string and hash. Appending at the end
- * leaves existing URL pair indices untouched, so Preview Pairs in the
- * `preview` query param stay valid as-is.
+ * split-layout URL, keeping its query string and hash.
*/
export const appendSettingsSplitToUrl = (
urlString: string,
diff --git a/apps/web/src/lib/core/context/blockOpenTracking.ts b/apps/web/src/lib/core/context/blockOpenTracking.ts
deleted file mode 100644
index 061169fc69..0000000000
--- a/apps/web/src/lib/core/context/blockOpenTracking.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createContext } from 'solid-js';
-
-/**
- * Delay before a mounted block is recorded as opened. Presentation layers may
- * provide a delay for passively displayed content; ordinary blocks default to
- * immediate tracking.
- */
-export const BlockOpenTrackingDelayContext = createContext(0);
diff --git a/apps/web/src/lib/core/email-link/return-layout.ts b/apps/web/src/lib/core/email-link/return-layout.ts
index 27dea4fdb5..155172d929 100644
--- a/apps/web/src/lib/core/email-link/return-layout.ts
+++ b/apps/web/src/lib/core/email-link/return-layout.ts
@@ -4,7 +4,7 @@ const RETURN_LAYOUT_KEY = 'macro:inbox-link:return-layout';
export type InboxLinkReturn = {
/**
* The base-relative layout URL the flow started from — path plus query and
- * hash, so the `preview` param encoding Controller/Viewer Preview Pairs
+ * hash, so content location state
* survives with it.
*/
url: string;
diff --git a/apps/web/src/lib/core/hotkey/tokens.ts b/apps/web/src/lib/core/hotkey/tokens.ts
index cf421697d0..a347dacd32 100644
--- a/apps/web/src/lib/core/hotkey/tokens.ts
+++ b/apps/web/src/lib/core/hotkey/tokens.ts
@@ -27,7 +27,6 @@ export const TOKENS = {
// unified list
unifiedList: {
- togglePreview: 'unifiedList.togglePreview',
navigation: {
parent: 'unifiedList.navigation.parent',
child: 'unifiedList.navigation.child',
diff --git a/apps/web/src/lib/core/internal/BlockLoader.tsx b/apps/web/src/lib/core/internal/BlockLoader.tsx
index 5fe2a4502d..375327d4a2 100644
--- a/apps/web/src/lib/core/internal/BlockLoader.tsx
+++ b/apps/web/src/lib/core/internal/BlockLoader.tsx
@@ -4,7 +4,7 @@ import { useQueryClient } from '@queries/client';
import type { AccessLevel as UserAccessLevel } from '@service-storage/generated/schemas/accessLevel';
import { createAsync } from '@solidjs/router';
import { err, ok } from 'neverthrow';
-import { createEffect, type JSX, onCleanup, useContext } from 'solid-js';
+import { createEffect, type JSX, onCleanup } from 'solid-js';
import {
type BlockDefinition,
type BlockName,
@@ -13,7 +13,6 @@ import {
type LoadFunction,
useIsNestedBlock,
} from '../block';
-import { BlockOpenTrackingDelayContext } from '../context/blockOpenTracking';
import {
blockEditPermissionEnabledSignal,
blockErrorSignal,
@@ -65,9 +64,6 @@ export function BlockLoader<
const setEditPermissionEnabled = blockEditPermissionEnabledSignal.set;
const setHandle = blockHandleSignal.set;
const isNested = useIsNestedBlock();
- // Snapshot at mount so later presentation changes do not alter how an
- // already-mounted block is tracked.
- const openTrackingDelayMs = useContext(BlockOpenTrackingDelayContext);
const analytics = useAnalytics();
setLiveTrackingEnabled(props.definition.liveTrackingEnabled ?? false);
@@ -110,13 +106,8 @@ Check that the load function does not return a preload source when the intent is
}
});
- let openTrackTimer: ReturnType<typeof setTimeout> | undefined;
- onCleanup(() => clearTimeout(openTrackTimer));
-
createEffect(() => {
const result = getResult();
- // Any content change supersedes a still-pending "opened" track.
- clearTimeout(openTrackTimer);
if (!result) {
setData(undefined);
@@ -167,11 +158,7 @@ Check that the load function does not return a preload source when the intent is
});
};
- if (openTrackingDelayMs > 0) {
- openTrackTimer = setTimeout(trackOpened, openTrackingDelayMs);
- } else {
- trackOpened();
- }
+ trackOpened();
}
setData(() => data);
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index de1446776b..79c7308455 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -78,7 +78,7 @@ its existing navigation controls. Block detail panels (including Calendar) have
the main title when hidden, with separate preferences per block type.
Multiple desktop splits appear as individually bordered, medium-rounded panels with
-6px top, right, and bottom insets and 6px resizable gaps, including preview pairs.
+6px top, right, and bottom insets and 6px resizable gaps.
The leftmost panel sits flush against the app rail, whose divider is hidden while
multiple splits are open. A single split stays edge to edge. Touch layouts keep their existing presentation.
@@ -363,6 +363,10 @@ create a session before the user sends. Repeating it focuses the existing draft.
### Content already open
+Splits navigate independently. The retired Preview Pair mode no longer creates
+an adjacent viewer, redirects list navigation, or links split sizes and history.
+Inline details in workspaces continue to use their own navigation stack.
+
Entity content can be open in only one split or inline preview/detail view at a
time. Shell components may have duplicate splits when `allowDuplicate` is enabled.
An Agents conversation route counts as the same entity as its agent or chat block.
diff --git a/docs/EMAIL_FEATURE_ARCHITECTURE.md b/docs/EMAIL_FEATURE_ARCHITECTURE.md
index a0ad83d686..6060e6c15f 100644
--- a/docs/EMAIL_FEATURE_ARCHITECTURE.md
+++ b/docs/EMAIL_FEATURE_ARCHITECTURE.md
@@ -72,8 +72,8 @@ may import a block package, `@core/block`, or block-related signal modules.
callbacks use those captured functions instead of resolving a provider after
setup.
- `email-view` owns an `EntityDetailNavigationStack`. Ordinary list activation
- mounts the thread inside `/app/component/mail`; Shift-open and Preview Pair
- navigation continue through the standalone `/app/email/:threadId` block. The
+ mounts the thread inside `/app/component/mail`; Shift-open
+ navigation continues through the standalone `/app/email/:threadId` block. The
filtered data source outlives the list UI so Previous, Next, Mark done, and
restored list focus keep their source order while detail is mounted.