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.

fix: route reminders through native navigation (#6719)

gbirman5678f9bd7774
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsx
index a7a8b8f063..04b44b1971 100644
--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx
+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx
@@ -13,6 +13,7 @@ import {
setInviteModalOpen,
} from '@app/features/team-invitations/invite-modal';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';
import { globalSplitManager } from '@app/signal/splitLayout';
import { useSplitLayout } from '@components/app/split-layout/layout';
@@ -29,6 +30,7 @@ import { UserIcon } from '@core/component/UserIcon';
import {
ENABLE_CALLS,
enableCrm,
+ enableReminders,
isFeatureEnabled,
} from '@core/constant/featureFlags';
import type { SettingsTab } from '@core/constant/SettingsState';
@@ -138,6 +140,14 @@ const SIDEBAR_LINKS = [
hotkey: 't',
hotkeyToken: TOKENS.sidebar.goTo.tasks,
},
+ {
+ id: 'reminders',
+ label: 'Reminders',
+ href: LIST_VIEW_PATHS.reminders,
+ icon: getIconConfig('reminder').icon,
+ hotkey: 'm',
+ hotkeyToken: TOKENS.sidebar.goTo.reminders,
+ },
{
id: 'calendar',
label: 'Calendar',
@@ -227,12 +237,14 @@ export const GoToHotkeys = () => {
const calendarUiEnabled = useCalendarUiFlag();
const activityFeedEnabled = useActivityFeedFlag();
const recentViewEnabled = useRecentViewFlag();
+ const reminders = useFeatureFlag(enableReminders);
const links = createMemo((): SidebarItem[] =>
buildSidebarLinks(
gettingStartedEnabled(),
calendarUiEnabled(),
activityFeedEnabled(),
- recentViewEnabled()
+ recentViewEnabled(),
+ reminders().enabled
)
);
@@ -558,7 +570,7 @@ const RECENT_LINK: SidebarItem = {
/**
* Assemble the ordered sidebar link list: the static links plus Getting
- * started and the flag-gated Recent, Activity, Calendar, Calls, and CRM
+ * started and the flag-gated Recent, Activity, Calendar, Reminders, Calls, and CRM
* entries in their correct positions.
* Call from a reactive context — it reads `ENABLE_CALLS` / `isFeatureEnabled(enableCrm)`.
* `showGettingStarted` is the account-age gate (`useGettingStartedEnabled`),
@@ -569,10 +581,13 @@ const buildSidebarLinks = (
showGettingStarted: boolean,
showCalendar: boolean,
showActivity: boolean,
- showRecent: boolean
+ showRecent: boolean,
+ showReminders: boolean
): SidebarItem[] => {
let links: SidebarItem[] = SIDEBAR_LINKS.filter(
- (link) => showCalendar || link.id !== 'calendar'
+ (link) =>
+ (showCalendar || link.id !== 'calendar') &&
+ (showReminders || link.id !== 'reminders')
);
const insertAfter = (anchorId: string, link: SidebarItem) => {
diff --git a/apps/web/src/components/app/mobile/mobile-dock-views.ts b/apps/web/src/components/app/mobile/mobile-dock-views.ts
index c601e204c0..93e0b25369 100644
--- a/apps/web/src/components/app/mobile/mobile-dock-views.ts
+++ b/apps/web/src/components/app/mobile/mobile-dock-views.ts
@@ -1,8 +1,9 @@
import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { getIconConfig } from '@core/component/EntityIcon';
-import { enableCrm } from '@core/constant/featureFlags';
+import { enableCrm, enableReminders } from '@core/constant/featureFlags';
import BellIcon from '@phosphor/bell.svg';
+import BellSimpleIcon from '@phosphor/bell-simple.svg';
import BellFillIcon from '@phosphor-fill/bell-fill.svg';
import CalendarFillIcon from '@phosphor-fill/calendar-fill.svg';
import EmailFillIcon from '@phosphor-fill/envelope-fill.svg';
@@ -35,6 +36,12 @@ const MOBILE_DOCK_VIEWS: readonly MobileDockView[] = [
iconActive: BellFillIcon,
pillIcon: BellIcon,
},
+ {
+ id: 'reminders',
+ label: 'Reminders',
+ icon: BellSimpleIcon,
+ iconActive: BellFillIcon,
+ },
{
id: 'calendar',
label: 'Calendar',
@@ -69,9 +76,12 @@ const MOBILE_DOCK_VIEWS: readonly MobileDockView[] = [
export function useMobileDockViews() {
const calendarEnabled = useCalendarUiFlag();
const crm = useFeatureFlag(enableCrm);
+ const reminders = useFeatureFlag(enableReminders);
return createMemo(() =>
MOBILE_DOCK_VIEWS.filter(
(view) => view.id !== 'calendar' || calendarEnabled()
- ).filter((view) => view.id !== 'companies' || crm().enabled)
+ )
+ .filter((view) => view.id !== 'companies' || crm().enabled)
+ .filter((view) => view.id !== 'reminders' || reminders().enabled)
);
}
diff --git a/apps/web/src/components/app/mobile/mobile-nav-views.ts b/apps/web/src/components/app/mobile/mobile-nav-views.ts
index 3ff346df77..8917829bee 100644
--- a/apps/web/src/components/app/mobile/mobile-nav-views.ts
+++ b/apps/web/src/components/app/mobile/mobile-nav-views.ts
@@ -7,6 +7,7 @@
export const MOBILE_NAV_VIEW_IDS = [
'search',
'home',
+ 'reminders',
'calendar',
'mail',
'channels',
diff --git a/apps/web/src/components/app/mobile/mobile-page-create-action.ts b/apps/web/src/components/app/mobile/mobile-page-create-action.ts
index a35271ee2e..dacbb316fe 100644
--- a/apps/web/src/components/app/mobile/mobile-page-create-action.ts
+++ b/apps/web/src/components/app/mobile/mobile-page-create-action.ts
@@ -9,6 +9,7 @@ const PAGE_CREATE_TOKENS: Partial<Record<MobileNavViewId, HotkeyToken>> = {
channels: TOKENS.create.message,
documents: TOKENS.create.note,
tasks: TOKENS.create.task,
+ reminders: TOKENS.create.reminder,
};
/** Resolve from the available launcher entries so feature gates apply here too. */
diff --git a/apps/web/src/components/app/previewTarget.ts b/apps/web/src/components/app/previewTarget.ts
index c640469dff..a056545d07 100644
--- a/apps/web/src/components/app/previewTarget.ts
+++ b/apps/web/src/components/app/previewTarget.ts
@@ -6,7 +6,6 @@ import {
getChannelEntityTarget,
getDocumentCommentTarget,
type ReminderPreviewSelection,
- reminderSplitTarget,
} from '@app/features/next-soup/utils';
import { getChannelParams } from '@block-channel/utils/link';
import type {
@@ -56,11 +55,13 @@ export type PreviewPanelSelection =
| IdOnlyPreviewSelection
| DocumentPreviewSelection
| ForeignPreviewSelection
- | ChannelPreviewSelection
- | ReminderPreviewSelection;
+ | ChannelPreviewSelection;
-/** What a list row may ask to preview: a block inline, or the Calendar view. */
-export type PreviewSelection = PreviewPanelSelection | CalendarPreviewSelection;
+/** What a list row may ask to preview: a block or a feature-owned detail view. */
+export type PreviewSelection =
+ | PreviewPanelSelection
+ | CalendarPreviewSelection
+ | ReminderPreviewSelection;
/** The block a selection opens, plus the params that load or locate its content. */
export type PreviewBlockTarget = {
@@ -125,14 +126,6 @@ export function previewBlockTarget(
blockId: contact.id,
aliasContext: undefined,
}))
- .with({ type: 'reminder' }, (reminder) => {
- const reminderTarget = reminderSplitTarget(reminder);
- return {
- blockType: fileTypeToResolvedBlockName(reminderTarget?.type),
- blockId: reminderTarget?.id ?? reminder.id,
- aliasContext: aliasContextFor(reminderTarget?.type),
- };
- })
.otherwise((fallbackEntity) => ({
blockType: fileTypeToResolvedBlockName(fallbackEntity.type),
blockId: fallbackEntity.id,
diff --git a/apps/web/src/components/app/sidebar-next/nav-items.test.ts b/apps/web/src/components/app/sidebar-next/nav-items.test.ts
new file mode 100644
index 0000000000..8cdede7389
--- /dev/null
+++ b/apps/web/src/components/app/sidebar-next/nav-items.test.ts
@@ -0,0 +1,23 @@
+import { describe, expect, it } from 'vitest';
+import { visibleNavItems } from './nav-items';
+
+describe('reminders navigation item', () => {
+ it('exposes the canonical list destination only while enabled', () => {
+ const enabled = visibleNavItems({
+ showCalendar: true,
+ showCustomers: true,
+ showReminders: true,
+ });
+ const disabled = visibleNavItems({
+ showCalendar: true,
+ showCustomers: true,
+ showReminders: false,
+ });
+
+ expect(enabled.find((item) => item.id === 'reminders')).toMatchObject({
+ label: 'Reminders',
+ href: '/reminders',
+ });
+ expect(disabled.some((item) => item.id === 'reminders')).toBe(false);
+ });
+});
diff --git a/apps/web/src/components/app/sidebar-next/nav-items.ts b/apps/web/src/components/app/sidebar-next/nav-items.ts
index eb144249d7..7cffceb928 100644
--- a/apps/web/src/components/app/sidebar-next/nav-items.ts
+++ b/apps/web/src/components/app/sidebar-next/nav-items.ts
@@ -2,6 +2,7 @@ import { LIST_VIEW_PATHS } from '@app/constants/list-views';
import { calendarPath } from '@app/features/calendar-view/calendar-url';
import type { SidebarItem } from '@components/app/app-sidebar/sidebar';
import { TOKENS } from '@core/hotkey/tokens';
+import BellIcon from '@phosphor/bell.svg';
import BuildingsIcon from '@phosphor/buildings.svg';
import CalendarBlankIcon from '@phosphor/calendar-blank.svg';
import ChatsCircleIcon from '@phosphor/chats-circle.svg';
@@ -10,6 +11,7 @@ import FolderSimpleIcon from '@phosphor/folder-simple.svg';
import HouseIcon from '@phosphor/house.svg';
import ListChecksIcon from '@phosphor/list-checks.svg';
import AgentIcon from '@phosphor/sparkle.svg';
+import BellFillIcon from '@phosphor-fill/bell-fill.svg';
import BuildingsFillIcon from '@phosphor-fill/buildings-fill.svg';
import CalendarBlankFillIcon from '@phosphor-fill/calendar-blank-fill.svg';
import ChatsCircleFillIcon from '@phosphor-fill/chats-circle-fill.svg';
@@ -52,6 +54,15 @@ const SIDEBAR_NEXT_NAV_ITEMS = [
hotkey: 'h',
hotkeyToken: TOKENS.sidebar.goTo.home,
},
+ {
+ id: 'reminders',
+ label: 'Reminders',
+ href: LIST_VIEW_PATHS.reminders,
+ icon: BellIcon,
+ iconActive: BellFillIcon,
+ hotkey: 'm',
+ hotkeyToken: TOKENS.sidebar.goTo.reminders,
+ },
{
id: 'documents',
label: 'Drive',
@@ -121,6 +132,7 @@ const SIDEBAR_NEXT_NAV_ITEMS = [
export type NavItemGates = {
showCalendar: boolean;
showCustomers: boolean;
+ showReminders: boolean;
};
/**
@@ -135,5 +147,6 @@ export const visibleNavItems = (gates: NavItemGates): SidebarNextNavItem[] =>
SIDEBAR_NEXT_NAV_ITEMS.filter((item) => {
if (item.id === 'calendar') return gates.showCalendar;
if (item.id === 'companies') return gates.showCustomers;
+ if (item.id === 'reminders') return gates.showReminders;
return true;
});
diff --git a/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts b/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts
index 521effacad..10eaac05d3 100644
--- a/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts
+++ b/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts
@@ -1,6 +1,6 @@
import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
-import { enableCrm } from '@core/constant/featureFlags';
+import { enableCrm, enableReminders } from '@core/constant/featureFlags';
import type { Accessor } from 'solid-js';
import type { NavItemGates } from './nav-items';
@@ -13,8 +13,10 @@ import type { NavItemGates } from './nav-items';
export function useNavItemGates(): Accessor<NavItemGates> {
const calendar = useCalendarUiFlag();
const crm = useFeatureFlag(enableCrm);
+ const reminders = useFeatureFlag(enableReminders);
return () => ({
showCalendar: calendar(),
showCustomers: crm().enabled,
+ showReminders: reminders().enabled,
});
}
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 9f7c161f92..f368e85b19 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -25,6 +25,7 @@ import {
ProjectView,
} from '@app/features/projects/project-view';
import { ReminderEditorSplit } from '@app/features/reminders/ReminderEditorSplit';
+import { REMINDER_DETAIL_COMPONENT_ID } from '@app/features/reminders/reminder-navigation';
import { RemindersRouteView } from '@app/features/reminders/route';
import { ReviewsRouteView } from '@app/features/reviews-view/route';
import { SettingsRouteView } from '@app/features/settings/route';
@@ -110,13 +111,6 @@ type ResolvedComponent = {
initialMeta?: ComponentMeta;
};
-/**
- * A reminder view carries its reminder id in the id slot — `reminder-view~<id>`
- * — because component params are dropped on URL restore (see `contentUrlSegments`)
- * and split identity is keyed on the id, so each reminder needs a distinct one.
- */
-const REMINDER_VIEW_PREFIX = 'reminder-view~';
-
export function resolveComponent(
name: string,
params?: ComponentParams
@@ -141,16 +135,6 @@ export function resolveComponent(
};
}
}
- if (name.startsWith(REMINDER_VIEW_PREFIX)) {
- const base = REGISTRY.get('reminder-view');
- if (base) {
- const reminderId = name.slice(REMINDER_VIEW_PREFIX.length);
- return {
- element: () => base.factory({ ...(params ?? {}), reminderId }),
- initialMeta: resolveInitialMeta('reminder-view', base.initialMeta),
- };
- }
- }
throw new Error(`Component '${name}' not registered`);
}
return {
@@ -355,8 +339,8 @@ registerComponent('skill-compose', (params) => {
usePageViewTracking('skill-compose');
return <ComposeSkill {...params} />;
});
-registerComponent('reminder-view', (params) => {
- usePageViewTracking('reminder-view');
+registerComponent(REMINDER_DETAIL_COMPONENT_ID, (params) => {
+ usePageViewTracking('reminder');
return <ReminderEditorSplit reminderId={params.reminderId as string} />;
});
registerComponent(
diff --git a/apps/web/src/components/app/split-layout/layoutManager.ts b/apps/web/src/components/app/split-layout/layoutManager.ts
index 1dcd8fb103..2a56aebb19 100644
--- a/apps/web/src/components/app/split-layout/layoutManager.ts
+++ b/apps/web/src/components/app/split-layout/layoutManager.ts
@@ -171,7 +171,7 @@ export type CreateNewSplitOptions = {
export type OpenWithSplitOptions = {
/** Route-owned targets must pass through middleware and content claims before opening. */
search?: Record<string, SplitSearchUpdate>;
- /** For routed opens, runs only after the router applies or reuses a destination. */
+ /** Runs after a cooperating navigator applies or reuses its destination. */
onApplied?: () => void;
mergeHistory?: boolean;
activate?: boolean;
@@ -281,6 +281,10 @@ export type SplitManager = {
| ((content: SplitContent, options: OpenWithSplitOptions) => void)
| undefined
) => void;
+ /** Whether the app router is currently bound for route-owned imperative opens. */
+ readonly contentNavigationReady: Accessor<boolean>;
+ /** Changes whenever the app router binding is installed, replaced, or removed. */
+ readonly contentNavigationVersion: Accessor<number>;
/** Find the view owning this content without activating it. */
findOpenView: (content: SplitContent) => OpenView | undefined;
/** Register live inline views; call the returned function when the host is disposed. */
@@ -660,9 +664,11 @@ export function createSplitLayout(
let exclusionFilter: ((split: SplitState) => boolean) | undefined;
let splitNavigationInterceptor: SplitNavigationInterceptor | undefined;
- let contentNavigator:
- | ((content: SplitContent, options: OpenWithSplitOptions) => void)
- | undefined;
+ const [contentNavigator, setContentNavigatorBinding] = createSignal<
+ ((content: SplitContent, options: OpenWithSplitOptions) => void) | undefined
+ >();
+ const [contentNavigationVersion, setContentNavigationVersion] =
+ createSignal(0);
const isExcluded = (split: SplitState) => exclusionFilter?.(split) ?? false;
const canAppendSplit = createMemo(
@@ -1670,9 +1676,10 @@ export function createSplitLayout(
): OpenSplitResult {
const sourceOwner = options.handle?.id;
if (options.search) {
- if (!contentNavigator)
+ const navigate = contentNavigator();
+ if (!navigate)
throw new Error('Split content navigation requires the app router');
- contentNavigator(content, options);
+ navigate(content, options);
return { status: 'navigating', sourceOwner };
}
const existing = findOpenView(content);
@@ -1869,6 +1876,8 @@ export function createSplitLayout(
canAppendSplit,
getVisibleSplits,
getVisibleSplitCount: () => getVisibleSplits().length,
+ contentNavigationReady: () => contentNavigator() !== undefined,
+ contentNavigationVersion,
setExclusionFilter: (fn) => {
exclusionFilter = fn;
},
@@ -1876,7 +1885,10 @@ export function createSplitLayout(
splitNavigationInterceptor = fn;
},
setContentNavigator: (navigate) => {
- contentNavigator = navigate;
+ batch(() => {
+ setContentNavigatorBinding(() => navigate);
+ setContentNavigationVersion((version) => version + 1);
+ });
},
};
}
diff --git a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts b/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts
index d895c2135b..bb936f74cf 100644
--- a/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts
+++ b/apps/web/src/components/app/split-layout/mobile/createMobileSwipeLayout.ts
@@ -127,8 +127,10 @@ export function createMobileSwipeLayout(
referredFrom,
mergeHistory: true,
});
- startForwardNavigation(bgHandle.id, options?.onApplied);
- return { status: 'reused', owner: bgHandle.id, split: bgHandle };
+ const deferred = startForwardNavigation(bgHandle.id, options?.onApplied);
+ return deferred
+ ? { status: 'navigating' }
+ : { status: 'reused', owner: bgHandle.id, split: bgHandle };
}
const newFgInitialHistory = fgHandle?.history() ?? [];
@@ -151,16 +153,23 @@ export function createMobileSwipeLayout(
});
if (!prepared) return { status: 'unavailable' };
- startForwardNavigation(prepared.id, options?.onApplied);
- return { status: 'opened', split: prepared };
+ const deferred = startForwardNavigation(prepared.id, options?.onApplied);
+ return deferred
+ ? { status: 'navigating' }
+ : { status: 'opened', split: prepared };
}
- function startForwardNavigation(splitId: SplitId, onApplied?: () => void) {
+ function startForwardNavigation(
+ splitId: SplitId,
+ onApplied?: () => void
+ ): boolean {
+ if (onApplied) pendingForwardApplied = { splitId, notify: onApplied };
if (forwardNavigationTrigger) {
- if (onApplied) pendingForwardApplied = { splitId, notify: onApplied };
forwardNavigationTrigger();
+ return true;
} else {
completeNavigateForward();
+ return false;
}
}
diff --git a/apps/web/src/components/app/split-layout/split-router/app-routes.ts b/apps/web/src/components/app/split-layout/split-router/app-routes.ts
index f162d72c5e..d87ce97421 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-routes.ts
+++ b/apps/web/src/components/app/split-layout/split-router/app-routes.ts
@@ -20,7 +20,10 @@ import {
recentRoute,
searchRoute,
} from '@app/features/next-soup/route';
-import { remindersRoute } from '@app/features/reminders/route';
+import {
+ reminderDetailRoute,
+ remindersRoute,
+} from '@app/features/reminders/route';
import { reviewsSplitRoute } from '@app/features/reviews-view/route';
import { settingsRoute } from '@app/features/settings/route';
import { tasksSplitRoute } from '@app/features/tasks-view/route';
@@ -39,6 +42,7 @@ export const appSplitRoutes = defineRoutes({
gettingStartedRoute,
recentRoute,
activityRoute,
+ reminderDetailRoute,
remindersRoute,
agentsViewRoute,
emailSplitRoute,
diff --git a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts b/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
index 8bfe1cce0c..5c07018963 100644
--- a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
+++ b/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
@@ -13,6 +13,12 @@ import {
import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';
import { channelsSearch } from '@app/features/channels-view/channels-route';
import { URL_PARAMS as EMAIL_URL_PARAMS } from '@app/features/email-thread/core/location';
+import {
+ REMINDER_DETAIL_COMPONENT_ID,
+ REMINDER_DETAIL_ROUTE_ID,
+ reminderDetailContent,
+ reminderIdFromDetailContent,
+} from '@app/features/reminders/reminder-navigation';
import {
defineRoute,
routeParams,
@@ -60,6 +66,8 @@ export function decodeLegacyPair(
}
if (type === 'component') {
+ // Reminder list/detail surfaces are native routes only.
+ if (id === 'reminders' || id === REMINDER_DETAIL_COMPONENT_ID) return;
// Preview Pair placeholders must never reach the view registry.
return {
type: 'component',
@@ -185,6 +193,18 @@ export function splitLocationFromContent(
routes: SplitRoutesManifest,
content: SplitContent
): SplitLocation {
+ const reminderId =
+ content.type === 'component' && content.id === REMINDER_DETAIL_COMPONENT_ID
+ ? reminderIdFromDetailContent(content)
+ : undefined;
+ if (reminderId) {
+ return {
+ route: {
+ matches: [{ id: REMINDER_DETAIL_ROUTE_ID, params: { reminderId } }],
+ },
+ };
+ }
+
if (
(content.type === 'component' && content.id === CALENDAR_VIEW_ID) ||
(content.type === 'calendar' && content.id === CALENDAR_BLOCK_ID)
@@ -338,6 +358,14 @@ export function splitContentFromLocation(
): SplitContent {
const root = location.route.matches[0];
+ if (root.id === REMINDER_DETAIL_ROUTE_ID) {
+ const { reminderId } = routeParams(location.route);
+ if (typeof reminderId === 'string' && reminderId.length > 0) {
+ return reminderDetailContent(reminderId);
+ }
+ throw new Error('Invalid reminder detail split route');
+ }
+
if (root.id.startsWith('view-'))
return { type: 'component', id: root.id.slice('view-'.length) };
if (root.id === 'drive') return { type: 'component', id: 'documents' };
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 86eed5c5a8..89f4e64d13 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
@@ -8,6 +8,10 @@ import {
emailThreadRoute,
} from '@app/features/email-view/route';
import { searchLocationUpdates } from '@app/features/next-soup/search-navigation';
+import {
+ reminderDetailContent,
+ reminderIdFromDetailContent,
+} from '@app/features/reminders/reminder-navigation';
import { reviewsHostedContent } from '@app/features/reviews-view/reviews-hosted-content';
import { reviewsSplitRoute } from '@app/features/reviews-view/route';
import {
@@ -42,6 +46,7 @@ import { createMobileSwipeLayout } from '../mobile/createMobileSwipeLayout';
import { createAppSplitRouterMiddleware } from '../split-router/app-middleware';
import { appSplitRoutes } from '../split-router/app-routes';
import { createContentNavigator } from '../split-router/content-navigation';
+import { decodeLegacyPair } from '../split-router/legacy-route';
import { createAppSplitRouterLayout } from '../splitRouterLayout';
// Settings UI imports the app route registry and is unrelated to layout behavior.
@@ -103,6 +108,26 @@ function createMockOrchestrator(): BlockOrchestrator {
}
describe('layoutManager', () => {
+ it('tracks content navigator replacement as a reactive host lifecycle', () => {
+ createRoot((dispose) => {
+ const manager = createSplitLayout(createMockOrchestrator(), [
+ { type: 'component', id: 'home' },
+ ]);
+ expect(manager.contentNavigationReady()).toBe(false);
+ expect(manager.contentNavigationVersion()).toBe(0);
+ manager.setContentNavigator(() => {});
+ expect(manager.contentNavigationReady()).toBe(true);
+ expect(manager.contentNavigationVersion()).toBe(1);
+ manager.setContentNavigator(() => {});
+ expect(manager.contentNavigationVersion()).toBe(2);
+ manager.setContentNavigator(undefined);
+
+ expect(manager.contentNavigationReady()).toBe(false);
+ expect(manager.contentNavigationVersion()).toBe(3);
+ dispose();
+ });
+ });
+
describe('header close action', () => {
it.each([false, true])(
'returns the sole visible split to its prior list (excluded background: %s)',
@@ -861,6 +886,60 @@ describe('layoutManager', () => {
});
}
+ it('shares reminder identity across Home and standalone routes', async () => {
+ const { manager, router, location, dispose } = ingressRouter(
+ '/home/reminder/reminder-a'
+ );
+ await router.settled();
+ const home = manager.activeSplit()!;
+ const firstApplied = vi.fn();
+
+ manager.openWithSplit(reminderDetailContent('reminder-a'), {
+ handle: home,
+ preferNewSplit: true,
+ search: {},
+ onApplied: firstApplied,
+ });
+ await router.settled();
+
+ expect(manager.splits()).toHaveLength(1);
+ expect(manager.activeSplitId()).toBe(home.id);
+ expect(firstApplied).toHaveBeenCalledOnce();
+
+ const secondApplied = vi.fn();
+ manager.openWithSplit(reminderDetailContent('reminder-b'), {
+ handle: home,
+ preferNewSplit: true,
+ search: {},
+ onApplied: secondApplied,
+ });
+ await router.settled();
+
+ expect(manager.splits()).toHaveLength(2);
+ expect(
+ reminderIdFromDetailContent(manager.activeSplit()!.content())
+ ).toBe('reminder-b');
+ expect(location.read().pathname).toContain('/reminder/reminder-b');
+ expect(secondApplied).toHaveBeenCalledOnce();
+
+ manager.openWithSplit(reminderDetailContent('reminder-a'), {
+ handle: manager.activeSplit(),
+ preferNewSplit: true,
+ search: {},
+ });
+ await router.settled();
+ expect(manager.splits()).toHaveLength(2);
+ expect(manager.activeSplitId()).toBe(home.id);
+
+ router.dispose();
+ dispose();
+ });
+
+ it('keeps reminder list and detail surfaces native-route only', () => {
+ expect(decodeLegacyPair('component', 'reminders')).toBeUndefined();
+ expect(decodeLegacyPair('component', 'reminder-detail')).toBeUndefined();
+ });
+
const searchTargets: {
type: SplitContent['type'];
target: SearchLocation;
@@ -2989,6 +3068,31 @@ describe('layoutManager', () => {
});
describe('activation invariant', () => {
+ it('reports direct mobile navigation applied after forward promotion', () => {
+ createRoot((dispose) => {
+ const manager = createSplitLayout(createMockOrchestrator(), [
+ { type: 'component', id: 'home' },
+ ]);
+ const swipe = createMobileSwipeLayout(manager);
+ const animate = vi.fn();
+ const onApplied = vi.fn();
+ swipe.setForwardNavigationTrigger(animate);
+
+ const result = manager.openWithSplit(
+ { type: 'email', id: 'thread' },
+ { onApplied }
+ );
+
+ expect(result).toMatchObject({ status: 'navigating' });
+ expect(animate).toHaveBeenCalledOnce();
+ expect(onApplied).not.toHaveBeenCalled();
+ swipe.completeNavigateForward();
+ expect(onApplied).toHaveBeenCalledOnce();
+
+ dispose();
+ });
+ });
+
it.each(['foreground', 'background'] as const)(
'reuses the mobile %s conversation across Agents routes and blocks',
(position) => {
diff --git a/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx b/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
index 790319a517..a4a57dcde2 100644
--- a/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
+++ b/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
@@ -45,6 +45,10 @@ function fallbackBreadcrumbName(target: EntityDetailTarget) {
return 'Untitled';
}
+function isReminderTarget(target: { type: string }) {
+ return target.type === 'reminder';
+}
+
function BreadcrumbItem(props: {
entry: EntityDetailNavigationEntry;
order: number;
@@ -112,7 +116,7 @@ export function EntityDetailBreadcrumbItem(props: {
return (
<Show
when={
- props.entry.data.type === 'reminder'
+ isReminderTarget(props.entry.data)
? undefined
: ({
id: props.entry.data.id,
diff --git a/apps/web/src/features/block-channel/utils/link.ts b/apps/web/src/features/block-channel/utils/link.ts
index 3cf84f2527..5e7bf28fdb 100644
--- a/apps/web/src/features/block-channel/utils/link.ts
+++ b/apps/web/src/features/block-channel/utils/link.ts
@@ -1,6 +1,7 @@
import { globalSplitManager } from '@app/signal/splitLayout';
import { URL_PARAMS } from '@block-channel/constants';
import type {
+ OpenSplitResult,
SplitHandle,
SplitManager,
} from '@components/app/split-layout/layoutManager';
@@ -61,16 +62,32 @@ export async function navigateToChannelMessage(
preferNewSplit?: boolean;
/** The split this navigation originates from. */
sourceHandle?: SplitHandle;
+ /** Runs once the destination has actually been applied or reused. */
+ onApplied?: VoidFunction;
}
) {
const splitManager = options?.splitManager ?? globalSplitManager();
if (!splitManager) return;
+ let onApplied = options?.onApplied;
+ const reportApplied = () => {
+ const callback = onApplied;
+ onApplied = undefined;
+ callback?.();
+ };
+ const reportImmediateResult = (result: OpenSplitResult | undefined) => {
+ if (!result) return;
+ if (result.status === 'opened' || result.status === 'reused') {
+ reportApplied();
+ }
+ };
+
const existing = splitManager.getSplitByContent('channel', channelId);
if (existing) {
existing.activate();
+ reportApplied();
} else {
- splitManager.openWithSplit(
+ const result = splitManager.openWithSplit(
{
type: 'channel',
id: channelId,
@@ -81,8 +98,10 @@ export async function navigateToChannelMessage(
referredFrom: null,
preferNewSplit: options?.preferNewSplit,
handle: options?.sourceHandle,
+ ...(options?.onApplied ? { onApplied: reportApplied } : {}),
}
);
+ reportImmediateResult(result);
}
await goToChannelMessage(orchestrator, channelId, messageId, threadId);
diff --git a/apps/web/src/features/calendar-view/calendar-navigation.ts b/apps/web/src/features/calendar-view/calendar-navigation.ts
index e994c29fdf..8959c90c2b 100644
--- a/apps/web/src/features/calendar-view/calendar-navigation.ts
+++ b/apps/web/src/features/calendar-view/calendar-navigation.ts
@@ -2,6 +2,7 @@ import { getPreferredCalendarPeriodView } from '@app/features/calendar/calendar-
import type { CalendarPeriodView } from '@app/features/calendar/types';
import { globalSplitManager } from '@app/signal/splitLayout';
import type {
+ OpenSplitResult,
ReferredFrom,
SplitContent,
SplitHandle,
@@ -68,11 +69,25 @@ export function openCalendarView(
openInNewSplit?: boolean;
mergeHistory?: boolean;
referredFrom?: ReferredFrom;
+ onApplied?: VoidFunction;
} = {}
): void {
const manager = options.manager ?? globalSplitManager();
if (!manager) return;
+ let onApplied = options.onApplied;
+ const reportApplied = () => {
+ const callback = onApplied;
+ onApplied = undefined;
+ callback?.();
+ };
+ const reportImmediateResult = (result: OpenSplitResult | undefined) => {
+ if (!result) return;
+ if (result.status === 'opened' || result.status === 'reused') {
+ reportApplied();
+ }
+ };
+
const content = calendarViewContent(target);
const existing = manager.getSplitByContent('component', CALENDAR_VIEW_ID);
if (existing) {
@@ -82,14 +97,17 @@ export function openCalendarView(
referredFrom: options.referredFrom,
});
existing.activate();
+ reportApplied();
return;
}
- manager.openWithSplit(content, {
+ const result = manager.openWithSplit(content, {
activate: true,
referredFrom: options.referredFrom ?? null,
preferNewSplit: options.openInNewSplit,
handle: options.handle,
mergeHistory: options.mergeHistory,
+ ...(options.onApplied ? { onApplied: reportApplied } : {}),
});
+ reportImmediateResult(result);
}
diff --git a/apps/web/src/features/entity/extractors-notification/notification-copy-link.test.ts b/apps/web/src/features/entity/extractors-notification/notification-copy-link.test.ts
new file mode 100644
index 0000000000..63ebccc451
--- /dev/null
+++ b/apps/web/src/features/entity/extractors-notification/notification-copy-link.test.ts
@@ -0,0 +1,72 @@
+const mocks = vi.hoisted(() => ({
+ writeText: vi.fn(),
+ success: vi.fn(),
+ remindersEnabled: true,
+}));
+
+vi.mock('@app/features/calendar-view/copy-event-mention', () => ({
+ copyCalendarEventMentionTarget: vi.fn(),
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: mocks.success },
+}));
+vi.mock('@core/constant/featureFlags', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@core/constant/featureFlags')>()),
+ enableReminders: { key: 'enable-reminders' },
+ isFeatureEnabled: () => mocks.remindersEnabled,
+}));
+vi.mock('@core/util/webOrigin', () => ({
+ getWebOrigin: () => 'https://macro.com',
+}));
+vi.mock('@notifications', () => ({
+ getChannelNotificationParams: () => ({}),
+}));
+
+import type { UnifiedNotification } from '@notifications';
+import { beforeEach, expect, it, vi } from 'vitest';
+import { copyNotificationLink } from './notification-copy-link';
+
+beforeEach(() => {
+ mocks.remindersEnabled = true;
+ vi.clearAllMocks();
+ vi.stubGlobal('navigator', { clipboard: { writeText: mocks.writeText } });
+});
+
+it('copies the canonical reminder detail URL', async () => {
+ const notification = {
+ entity_id: 'reminder-1',
+ notification_metadata: {
+ tag: 'reminder',
+ content: {
+ description: 'Review copied links',
+ reminderId: 'reminder-1',
+ },
+ },
+ } as UnifiedNotification;
+
+ await copyNotificationLink(notification);
+
+ expect(mocks.writeText).toHaveBeenCalledExactlyOnceWith(
+ 'https://macro.com/app/reminder/reminder-1'
+ );
+ expect(mocks.success).toHaveBeenCalledWith('Link copied to clipboard');
+});
+
+it('does not expose a reminder detail URL while reminders are disabled', async () => {
+ mocks.remindersEnabled = false;
+ const notification = {
+ entity_id: 'reminder-1',
+ notification_metadata: {
+ tag: 'reminder',
+ content: {
+ description: 'Review copied links',
+ reminderId: 'reminder-1',
+ },
+ },
+ } as UnifiedNotification;
+
+ await copyNotificationLink(notification);
+
+ expect(mocks.writeText).not.toHaveBeenCalled();
+ expect(mocks.success).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts b/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts
index 64e959d177..f4f8799c47 100644
--- a/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts
+++ b/apps/web/src/features/entity/extractors-notification/notification-copy-link.ts
@@ -1,5 +1,7 @@
import { copyCalendarEventMentionTarget } from '@app/features/calendar-view/copy-event-mention';
+import { reminderDetailUrl } from '@app/features/reminders/reminder-navigation';
import { toast } from '@core/component/Toast/Toast';
+import { enableReminders, isFeatureEnabled } from '@core/constant/featureFlags';
import { buildSimpleEntityUrl } from '@core/util/url';
import {
getChannelNotificationParams,
@@ -25,6 +27,14 @@ export async function copyNotificationLink(notification: UnifiedNotification) {
});
return;
}
+ if (metadata.tag === 'reminder') {
+ if (!isFeatureEnabled(enableReminders)) return;
+ await navigator.clipboard.writeText(
+ reminderDetailUrl(notification.entity_id)
+ );
+ toast.success('Link copied to clipboard');
+ return;
+ }
const { params } = getChannelNotificationParams(notification);
await navigator.clipboard.writeText(
diff --git a/apps/web/src/features/home/components/HomeReminderDetailRouteView.tsx b/apps/web/src/features/home/components/HomeReminderDetailRouteView.tsx
new file mode 100644
index 0000000000..1880d56e2a
--- /dev/null
+++ b/apps/web/src/features/home/components/HomeReminderDetailRouteView.tsx
@@ -0,0 +1,52 @@
+import { ReminderDetails } from '@app/features/reminders/ReminderEditorSplit';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { useParams } from '@app/lib/split-router';
+import { PreviewFrame } from '@components/app/PreviewPanel';
+import {
+ useSplitDisplayName,
+ useSplitPanelOrThrow,
+} from '@components/app/split-layout/layoutUtils';
+import { LoadingBlock } from '@core/component/LoadingBlock';
+import { enableReminders } from '@core/constant/featureFlags';
+import { createEffect, on, Show } from 'solid-js';
+import { useHomeView } from '../home-view-context';
+import { HomeReturnBreadcrumb } from './HomeReturnBreadcrumb';
+
+/** Lightweight reminder details inside Home's current route-owned preview. */
+export function HomeReminderDetailRouteView() {
+ const params = useParams<{ reminderId?: string }>();
+ const panel = useSplitPanelOrThrow();
+ const reminders = useFeatureFlag(enableReminders);
+ const { closePreview } = useHomeView();
+ useSplitDisplayName(() =>
+ reminders().loading || !reminders().enabled ? undefined : 'Reminder'
+ );
+
+ createEffect(
+ on(
+ () => (reminders().loading ? undefined : reminders().enabled),
+ (enabled) => {
+ if (enabled === false) closePreview();
+ }
+ )
+ );
+
+ return (
+ <Show when={!reminders().loading} fallback={<LoadingBlock />}>
+ <Show when={reminders().enabled}>
+ <div class="flex size-full min-h-0">
+ <PreviewFrame
+ splitPanelContext={panel}
+ headerLeading={<HomeReturnBreadcrumb onReturn={closePreview} />}
+ locationKey={() => params.reminderId}
+ >
+ <ReminderDetails
+ reminderId={params.reminderId}
+ onClose={closePreview}
+ />
+ </PreviewFrame>
+ </div>
+ </Show>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/home/home-view-context.tsx b/apps/web/src/features/home/home-view-context.tsx
index 569fe75286..01e5ab8b00 100644
--- a/apps/web/src/features/home/home-view-context.tsx
+++ b/apps/web/src/features/home/home-view-context.tsx
@@ -49,6 +49,7 @@ import {
homeChannelRoute,
homeDocumentRoute,
homePreviewRoute,
+ homeReminderRoute,
homeSplitRoute,
} from './route';
import type {
@@ -71,6 +72,8 @@ export type HomeViewContext = {
previewNavigationRequest: Accessor<number>;
/** Whether the route opens the Calendar view inline. */
calendarOpen: Accessor<boolean>;
+ /** Whether the route opens a reminder inline. */
+ reminderOpen: Accessor<boolean>;
/** Bumped when the open calendar event is requested again, to re-aim in place. */
calendarRefocus: Accessor<number>;
openPreview: (entity: PreviewSelection) => boolean;
@@ -90,8 +93,9 @@ export const [HomeViewProvider, useHomeView] = createAssertedContextProvider<
const panel = useSplitPanelOrThrow();
const userId = useUserId();
const navigate = useNavigate();
- const routeParams =
- useParams<Parameters<typeof homeDetailParamsFromRoute>[0]>();
+ const routeParams = useParams<
+ Parameters<typeof homeDetailParamsFromRoute>[0] & { reminderId?: string }
+ >();
const [channelSearch] = createSearchParams(channelsSearch);
const [documentSearch] = createSearchParams(driveSearch);
const [tabSearch] = createSearchParams(homeTabSearch);
@@ -156,6 +160,7 @@ export const [HomeViewProvider, useHomeView] = createAssertedContextProvider<
});
const { calendarOpen, calendarRefocus, openCalendarEvent } =
useHomeCalendarPreview(withTab);
+ const reminderOpen = () => typeof routeParams.reminderId === 'string';
const navigateDetail = (
{ params, search }: HomePreviewNavigation,
replace = false
@@ -185,6 +190,13 @@ export const [HomeViewProvider, useHomeView] = createAssertedContextProvider<
if (entity.type === 'calendar_event') {
return openCalendarEvent(entity);
}
+ if (entity.type === 'reminder') {
+ navigate(
+ { route: homeReminderRoute, params: { reminderId: entity.id } },
+ { search: withTab(homeDetailSearch()) }
+ );
+ return true;
+ }
const target = previewBlockTarget(entity);
if (!selectPreview.canSelect(target)) return false;
const current = previewTarget();
@@ -236,6 +248,7 @@ export const [HomeViewProvider, useHomeView] = createAssertedContextProvider<
previewNavigationRequest,
calendarOpen,
calendarRefocus,
+ reminderOpen,
openPreview,
closePreview,
setTab,
diff --git a/apps/web/src/features/home/home-view.tsx b/apps/web/src/features/home/home-view.tsx
index e2fef6894c..4b1478eaf0 100644
--- a/apps/web/src/features/home/home-view.tsx
+++ b/apps/web/src/features/home/home-view.tsx
@@ -78,6 +78,7 @@ function HomeViewRoot() {
setTab,
previewTarget,
calendarOpen,
+ reminderOpen,
openPreview,
closePreview,
} = useHomeView();
@@ -116,7 +117,9 @@ function HomeViewRoot() {
<DebugSuspense name="HomeView.list-pane">
<HomeListPane
hasPreview={
- previewTarget() !== undefined || calendarOpen()
+ previewTarget() !== undefined ||
+ calendarOpen() ||
+ reminderOpen()
}
onPreviewEntityChange={onPreviewEntityChange}
onNewChat={newChat}
@@ -145,7 +148,9 @@ function HomeViewRoot() {
<DebugSuspense name="HomeView.list-pane">
<HomeListPane
hasPreview={
- previewTarget() !== undefined || calendarOpen()
+ previewTarget() !== undefined ||
+ calendarOpen() ||
+ reminderOpen()
}
onPreviewEntityChange={onPreviewEntityChange}
onNewChat={newChat}
diff --git a/apps/web/src/features/home/route.tsx b/apps/web/src/features/home/route.tsx
index 0159501345..4a16d7581d 100644
--- a/apps/web/src/features/home/route.tsx
+++ b/apps/web/src/features/home/route.tsx
@@ -9,6 +9,7 @@ import { channelsSearch } from '@app/features/channels-view/channels-route';
import { channelDetailRoute } from '@app/features/channels-view/route';
import { driveSearch } from '@app/features/drive-view/primitives/drive-search';
import { driveRootDocumentRoute } from '@app/features/drive-view/route';
+import { HOME_REMINDER_DETAIL_ROUTE_ID } from '@app/features/reminders/reminder-navigation';
import {
createSearchParams,
defineRoute,
@@ -26,8 +27,10 @@ import {
} from '@components/app/split-layout/split-router/app-route-shell';
import { uuidRouteReference } from '@components/app/split-layout/split-router/mention-links';
import { Show } from 'solid-js';
+import { z } from 'zod';
import { URL_PARAMS as EMAIL_URL_PARAMS } from '../email-thread/core/location';
import { HomeEntityDetailRouteView } from './components/HomeEntityDetailRouteView';
+import { HomeReminderDetailRouteView } from './components/HomeReminderDetailRouteView';
import {
homeCalendarLegacyTarget,
homeDetailParamsFromRoute,
@@ -49,6 +52,7 @@ type HomeDetailParams = Partial<HomePreviewRouteParams> & {
channelId?: string;
documentType?: string;
documentId?: string;
+ reminderId?: string;
period?: CalendarPeriodView;
};
@@ -79,6 +83,7 @@ export const HomeRouteView = withAuth(() => {
const params = useParams<HomeDetailParams>();
const detailRequested = () =>
homeDetailParamsFromRoute(params) !== undefined ||
+ typeof params.reminderId === 'string' ||
typeof params.period === 'string';
return (
@@ -132,6 +137,16 @@ export const homeDocumentRoute = defineRoute({
remountKey: ({ documentType, documentId }) =>
`${homeBaseBlockType(documentType)}:${documentId}`,
});
+
+export const homeReminderRoute = defineRoute({
+ id: HOME_REMINDER_DETAIL_ROUTE_ID,
+ path: 'reminder/:reminderId',
+ params: z.object({ reminderId: z.string().min(1) }),
+ component: HomeReminderDetailRouteView,
+ remountKey: ({ reminderId }) => reminderId,
+ claim: ({ reminderId }) => ({ namespace: 'reminder', id: reminderId }),
+});
+
export const homePreviewRoute = defineRoute({
id: 'home-preview',
path: ':blockType/:previewId',
@@ -181,6 +196,7 @@ export const homeSplitRoute = defineRoute({
homeCalendarRoute,
homeChannelRoute,
homeDocumentRoute,
+ homeReminderRoute,
homePreviewRoute,
],
});
diff --git a/apps/web/src/features/next-soup/actions/make-copy-link-action.test.ts b/apps/web/src/features/next-soup/actions/make-copy-link-action.test.ts
new file mode 100644
index 0000000000..3cfaea8a57
--- /dev/null
+++ b/apps/web/src/features/next-soup/actions/make-copy-link-action.test.ts
@@ -0,0 +1,71 @@
+const mocks = vi.hoisted(() => ({
+ remindersEnabled: true,
+ success: vi.fn(),
+ writeText: vi.fn(),
+}));
+
+vi.mock('@app/features/calendar-view/copy-event-mention', () => ({
+ copyCalendarEventMentionTarget: vi.fn(),
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: mocks.success },
+}));
+vi.mock('@core/constant/featureFlags', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@core/constant/featureFlags')>()),
+ enableReminders: { key: 'enable-reminders' },
+ isFeatureEnabled: () => mocks.remindersEnabled,
+}));
+vi.mock('@core/util/url', () => ({
+ buildSimpleEntityUrl: ({ type, id }: { type: string; id: string }) =>
+ `https://macro.com/app/${type}/${id}`,
+}));
+vi.mock('@service-connection/websocket', () => ({
+ ws: { addEventListener: vi.fn(), send: vi.fn() },
+ state: () => 'closed',
+ createConnectionBlockWebsocketEffect: vi.fn(),
+ createConnectionWebsocketEffect: vi.fn(),
+}));
+vi.mock('@service-storage/websocket', () => ({
+ storageWS: { reconnectIfDisconnected: vi.fn() },
+ createWebSocketJob: vi.fn(),
+}));
+vi.mock('../utils', () => ({ calendarEventLinkTarget: vi.fn() }));
+
+import type { EntityData } from '@entity';
+import { beforeEach, expect, it, vi } from 'vitest';
+import { makeCopyLinkAction } from './make-copy-link-action';
+
+const reminder = {
+ id: 'reminder-1',
+ type: 'reminder',
+ name: 'Review route links',
+} as EntityData;
+
+beforeEach(() => {
+ mocks.remindersEnabled = true;
+ mocks.success.mockClear();
+ mocks.writeText.mockClear();
+ vi.stubGlobal('navigator', { clipboard: { writeText: mocks.writeText } });
+});
+
+it('copies the canonical reminder route while the feature is enabled', async () => {
+ const action = makeCopyLinkAction();
+
+ expect(action.canExecute(reminder)).toBe(true);
+ await action.execute([reminder]);
+
+ expect(mocks.writeText).toHaveBeenCalledExactlyOnceWith(
+ 'https://macro.com/app/reminder/reminder-1'
+ );
+ expect(mocks.success).toHaveBeenCalledWith('Link copied to clipboard');
+});
+
+it('does not expose a reminder route while the feature is disabled', async () => {
+ mocks.remindersEnabled = false;
+ const action = makeCopyLinkAction();
+
+ expect(action.canExecute(reminder)).toBe(false);
+ await action.execute([reminder]);
+
+ expect(mocks.writeText).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts b/apps/web/src/features/next-soup/actions/make-copy-link-action.ts
index eb0a0c9e4d..e82d8db86b 100644
--- a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-copy-link-action.ts
@@ -1,7 +1,9 @@
import { copyCalendarEventMentionTarget } from '@app/features/calendar-view/copy-event-mention';
+import { reminderDetailUrl } from '@app/features/reminders/reminder-navigation';
import { getChannelParams } from '@block-channel/utils/link';
import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
+import { enableReminders, isFeatureEnabled } from '@core/constant/featureFlags';
import { buildSimpleEntityUrl } from '@core/util/url';
import { type EntityData, isGithubPrEntity } from '@entity';
import { calendarEventLinkTarget } from '../utils';
@@ -47,6 +49,7 @@ const getEntityUrl = (entity: EntityData): string => {
id: encodeURIComponent(entity.id),
});
}
+ if (entity.type === 'reminder') return reminderDetailUrl(entity.id);
return buildSimpleEntityUrl(
{
@@ -58,15 +61,16 @@ const getEntityUrl = (entity: EntityData): string => {
};
export const makeCopyLinkAction = () => {
- // A reminder has no block of its own, so `/app/reminder/{id}` resolves to
- // nothing the orchestrator can open — there is no link to copy.
const canExecute = (entity: EntityData): boolean =>
- entity.type !== 'reminder';
+ entity.type !== 'reminder' || isFeatureEnabled(enableReminders);
const execute = async (entities: EntityData[]) => {
// Only copy link for the first entity (doesn't make sense for bulk)
const entity = entities[0];
if (!entity) return;
+ if (entity.type === 'reminder' && !isFeatureEnabled(enableReminders)) {
+ return;
+ }
// The calendar is a singleton block, so there is no /app/calendar_event
// route to link an event by id. Events copy the deep link the calendar's
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 b193172743..50d8a9b1fa 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,7 +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. Single-entity only, like creating one.
+ * native detail route. Single-entity only, like creating one.
*/
export const makeEditReminderAction = () => {
const canExecute = (entity: EntityData): boolean =>
diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.ts
index 6c5c9eac71..33630a21cb 100644
--- a/apps/web/src/features/next-soup/utils.test.ts
+++ b/apps/web/src/features/next-soup/utils.test.ts
@@ -58,6 +58,7 @@ const operationMocks = vi.hoisted(() => {
),
invalidateRemindersById: vi.fn(),
invalidateSoupEntity: vi.fn(async () => {}),
+ openExternalUrl: vi.fn(),
setReminderCompleted: vi.fn(async () => {}),
updateNotificationsForEntities: vi.fn(
async (): Promise<Array<{ id: string }>> => []
@@ -81,6 +82,10 @@ vi.mock('@queries/email/integration', async (importOriginal) => ({
...(await importOriginal<typeof import('@queries/email/integration')>()),
archiveEmailThread: operationMocks.archive,
}));
+vi.mock('@core/util/url', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@core/util/url')>()),
+ openExternalUrl: operationMocks.openExternalUrl,
+}));
vi.mock('@queries/client', () => ({
queryClient: {
cancelQueries: operationMocks.cancelQueries,
@@ -119,8 +124,10 @@ vi.mock('@core/constant/featureFlags', async (importOriginal) => {
return {
...actual,
enableCalendarUi: { key: 'enable-calendar-ui' },
+ enableReminders: { key: 'enable-reminders' },
isFeatureEnabled: (flag: Parameters<typeof actual.isFeatureEnabled>[0]) =>
- 'key' in flag && flag.key === 'enable-calendar-ui'
+ 'key' in flag &&
+ (flag.key === 'enable-calendar-ui' || flag.key === 'enable-reminders')
? true
: actual.isFeatureEnabled(flag),
};
@@ -146,6 +153,7 @@ import {
getDocumentCommentTarget,
getRowClickFallbackLocation,
markChannelNotificationsSeenOnOpen,
+ openEntityInNewTab,
openEntityInSplitFromUnifiedList,
resolveMarkEntitiesDoneVariables,
} from './utils';
@@ -166,6 +174,48 @@ afterEach(() => {
vi.mocked(isTouchDevice).mockReturnValue(false);
});
+describe('reminder navigation', () => {
+ const reminder = {
+ type: 'reminder',
+ id: 'reminder-1',
+ name: 'Review reminder navigation',
+ } as EntityData;
+
+ it.each([false, true])(
+ 'uses the reminder route for list opening (new split: %s)',
+ async (openInNewSplit) => {
+ const openWithSplit = vi.fn(() => ({ status: 'navigating' as const }));
+ setGlobalSplitManager({
+ activeSplit: () => undefined,
+ openWithSplit,
+ } as unknown as SplitManager);
+
+ await openEntityInSplitFromUnifiedList(reminder, { openInNewSplit });
+
+ expect(openWithSplit).toHaveBeenCalledExactlyOnceWith(
+ expect.objectContaining({
+ type: 'component',
+ id: 'reminder-detail',
+ params: { reminderId: 'reminder-1' },
+ }),
+ expect.objectContaining({
+ activate: true,
+ preferNewSplit: openInNewSplit,
+ search: {},
+ })
+ );
+ }
+ );
+
+ it('uses the same reminder component URL for a new browser tab', () => {
+ openEntityInNewTab({ entity: reminder });
+
+ expect(operationMocks.openExternalUrl).toHaveBeenCalledExactlyOnceWith(
+ expect.stringMatching(/\/app\/reminder\/reminder-1$/)
+ );
+ });
+});
+
describe('agent session search navigation', () => {
const entity = {
type: 'agent_session' as const,
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index 8c681b737a..91905a8a40 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -15,6 +15,11 @@ import {
} from '@app/features/calendar-view/types';
import { driveHostedContent } from '@app/features/drive-view/drive-hosted-content';
import { projectRouteId } from '@app/features/projects/core/route';
+import {
+ openReminderDetail,
+ reminderDetailDestination,
+ reminderDetailUrl,
+} from '@app/features/reminders/reminder-navigation';
import { reviewsHostedContent } from '@app/features/reviews-view/reviews-hosted-content';
import { withListNavigationSource } from '@app/features/soup/collection/list-navigation-source';
import {
@@ -42,6 +47,7 @@ import {
import {
enableCalendarUi,
enableGraphqlSoup,
+ enableReminders,
isFeatureEnabled,
USE_MACRO_PR_SUMMARY_BLOCK,
} from '@core/constant/featureFlags';
@@ -261,16 +267,9 @@ export const openEntityInNewTab = ({
location?: SearchLocation;
}) => {
location ??= getRowClickFallbackLocation(entity);
- // A reminder opens its own editor — a `reminder-view` component split with a
- // URL of its own — the same as the split paths, even a standalone one that
- // references nothing.
if (entity.type === 'reminder') {
- openExternalUrl(
- new URL(
- `/app/component/reminder-view~${entity.id}`,
- window.location.origin
- ).href
- );
+ if (!isFeatureEnabled(enableReminders)) return;
+ openExternalUrl(reminderDetailUrl(entity.id));
return;
}
@@ -699,6 +698,24 @@ export const openEntityInSplitFromUnifiedList = async (
return;
}
+ if (entity.type === 'reminder') {
+ if (!isFeatureEnabled(enableReminders)) return;
+ const sourceContent =
+ splitHandle?.content() ?? splitManager.activeSplit()?.content();
+ const sourceListView =
+ sourceContent?.type === 'component' && isListViewID(sourceContent.id)
+ ? sourceContent.id
+ : undefined;
+ openReminderDetail(entity.id, {
+ manager: splitManager,
+ handle: splitHandle,
+ openInNewSplit,
+ mergeHistory,
+ referredFrom: options.referredFrom ?? sourceListView,
+ });
+ return;
+ }
+
const blockOrchestrator = splitManager.getOrchestrator();
if (entity.type === 'channel' && entity.unreadNotifications !== undefined) {
@@ -931,30 +948,13 @@ export function calendarViewTargetForEntity(
}
/**
- * The entity a reminder references, as block content. A reminder itself opens
- * its own `reminder-view` editor (see `getEntitySplitContent`); this is only
- * the reference, used where the reference is shown directly (PreviewPanel).
- * `undefined` for a standalone reminder, which points at nothing.
- *
- * `fileType`/`subType` come resolved from the server, so a referenced document
- * lands on its real block rather than 'unknown'.
+ * The minimal reminder selection accepted by Home's feature-owned detail route.
*/
export type ReminderPreviewSelection = Pick<
ReminderEntity,
'id' | 'type' | 'referencedEntity'
>;
-export function reminderSplitTarget(entity: ReminderPreviewSelection) {
- const referenced = entity.referencedEntity;
- if (!referenced) return undefined;
- return {
- type: fileTypeToBlockName(
- referenced.subType ?? referenced.fileType ?? referenced.type
- ),
- id: referenced.id,
- };
-}
-
// TODO(dev-rb/github): Map GitHub PRs to { type: 'pr', id }.
function getEntitySplitContent(entity: EntityData) {
return (
@@ -989,14 +989,7 @@ function getEntitySplitContent(entity: EntityData) {
return { type: 'contact' as const, id: entity.id };
})
.with({ type: 'reminder' }, (entity) => {
- // A reminder has no block of its own; it opens its editor as a
- // component split. The reminder id rides in the content id (component
- // params are dropped on URL restore, and split identity is keyed on the
- // id, so each reminder needs a distinct one) — see `resolveComponent`.
- return {
- type: 'component' as const,
- id: `reminder-view~${entity.id}`,
- };
+ return reminderDetailDestination(entity.id).content;
})
// Calendar events open the singleton Calendar application view; the open
// path branches before reaching here, so this only serves duplicate checks.
diff --git a/apps/web/src/features/notifications/PendingNotificationNavigationEffect.test.tsx b/apps/web/src/features/notifications/PendingNotificationNavigationEffect.test.tsx
new file mode 100644
index 0000000000..300af7e849
--- /dev/null
+++ b/apps/web/src/features/notifications/PendingNotificationNavigationEffect.test.tsx
@@ -0,0 +1,197 @@
+const mocks = vi.hoisted(() => ({
+ openNotificationFromId: vi.fn(),
+}));
+
+vi.mock('@notifications', async () => ({
+ ...(await import('./notification-navigation-intent')),
+ openNotificationFromId: mocks.openNotificationFromId,
+}));
+
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { failure: vi.fn() },
+}));
+
+import { setGlobalSplitManager } from '@app/signal/splitLayout';
+import type {
+ SplitEventWithType,
+ SplitManager,
+} from '@components/app/split-layout/layoutManager';
+import { batch, createRoot, createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import {
+ pendingNotificationNavigationId,
+ setPendingNotificationNavigationId,
+} from './notification-navigation-intent';
+import type { NotificationSource } from './notification-source';
+import { usePendingNotificationNavigationEffect } from './PendingNotificationNavigationEffect';
+
+type OpenAttempt = {
+ canOpen: () => boolean;
+ onApplied: VoidFunction;
+ succeed: VoidFunction;
+};
+
+function managerHarness(initiallyReady = false) {
+ const [ready, setReady] = createSignal(initiallyReady);
+ const [version, setVersion] = createSignal(initiallyReady ? 1 : 0);
+ const [event, setEvent] = createSignal<SplitEventWithType | undefined>(
+ undefined,
+ { equals: false }
+ );
+ const manager = {
+ contentNavigationReady: ready,
+ contentNavigationVersion: version,
+ events: event,
+ } as unknown as SplitManager;
+
+ return {
+ manager,
+ bind: () => {
+ batch(() => {
+ setReady(true);
+ setVersion((value) => value + 1);
+ });
+ },
+ unbind: () => {
+ batch(() => {
+ setReady(false);
+ setVersion((value) => value + 1);
+ });
+ },
+ reconcile: () => setEvent({ type: 3 } as SplitEventWithType),
+ };
+}
+
+describe('usePendingNotificationNavigationEffect', () => {
+ let dispose: VoidFunction | undefined;
+ let attempts: OpenAttempt[];
+
+ beforeEach(() => {
+ attempts = [];
+ mocks.openNotificationFromId.mockReset();
+ mocks.openNotificationFromId.mockImplementation(
+ (
+ _notificationId: string,
+ _manager: SplitManager,
+ _source: NotificationSource,
+ options: Pick<OpenAttempt, 'canOpen' | 'onApplied'>
+ ) => ({
+ match: (onSuccess: VoidFunction) => {
+ attempts.push({ ...options, succeed: onSuccess });
+ },
+ })
+ );
+ setPendingNotificationNavigationId(undefined);
+ setGlobalSplitManager(undefined);
+ });
+
+ afterEach(() => {
+ dispose?.();
+ dispose = undefined;
+ setPendingNotificationNavigationId(undefined);
+ setGlobalSplitManager(undefined);
+ });
+
+ function mount(source = {} as NotificationSource) {
+ dispose = createRoot((rootDispose) => {
+ usePendingNotificationNavigationEffect(source);
+ return rootDispose;
+ });
+ return source;
+ }
+
+ it('keeps a startup intent pending until the native host applies it', async () => {
+ const host = managerHarness();
+ const source = mount();
+ setGlobalSplitManager(host.manager);
+ setPendingNotificationNavigationId('notification-1');
+ await Promise.resolve();
+
+ expect(mocks.openNotificationFromId).not.toHaveBeenCalled();
+ expect(pendingNotificationNavigationId()).toBe('notification-1');
+
+ host.bind();
+ await Promise.resolve();
+
+ expect(mocks.openNotificationFromId).toHaveBeenCalledExactlyOnceWith(
+ 'notification-1',
+ host.manager,
+ source,
+ { canOpen: expect.any(Function), onApplied: expect.any(Function) }
+ );
+ expect(attempts[0]?.canOpen()).toBe(true);
+
+ attempts[0]?.succeed();
+ expect(pendingNotificationNavigationId()).toBe('notification-1');
+
+ attempts[0]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBeUndefined();
+ });
+
+ it('retries a settled but aborted request after layout reconciliation', async () => {
+ const host = managerHarness(true);
+ mount();
+ setGlobalSplitManager(host.manager);
+ setPendingNotificationNavigationId('notification-1');
+ await Promise.resolve();
+ expect(attempts).toHaveLength(1);
+
+ host.reconcile();
+ await Promise.resolve();
+ expect(attempts).toHaveLength(1);
+
+ attempts[0]?.succeed();
+ await Promise.resolve();
+ expect(attempts).toHaveLength(2);
+
+ attempts[0]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBe('notification-1');
+ attempts[1]?.succeed();
+ attempts[1]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBeUndefined();
+ });
+
+ it('invalidates an in-flight request when the route host is replaced', async () => {
+ const host = managerHarness(true);
+ mount();
+ setGlobalSplitManager(host.manager);
+ setPendingNotificationNavigationId('notification-1');
+ await Promise.resolve();
+ expect(attempts).toHaveLength(1);
+
+ host.unbind();
+ expect(attempts[0]?.canOpen()).toBe(false);
+ host.bind();
+ await Promise.resolve();
+ expect(attempts).toHaveLength(2);
+
+ attempts[0]?.succeed();
+ attempts[0]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBe('notification-1');
+ attempts[1]?.succeed();
+ attempts[1]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBeUndefined();
+ });
+
+ it('keeps the intent across account teardown and ignores stale completion', async () => {
+ const first = managerHarness(true);
+ const second = managerHarness(true);
+ mount();
+ setGlobalSplitManager(first.manager);
+ setPendingNotificationNavigationId('notification-1');
+ await Promise.resolve();
+ expect(attempts).toHaveLength(1);
+
+ setGlobalSplitManager(undefined);
+ attempts[0]?.succeed();
+ attempts[0]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBe('notification-1');
+
+ setGlobalSplitManager(second.manager);
+ await Promise.resolve();
+ expect(attempts).toHaveLength(2);
+ attempts[1]?.succeed();
+ attempts[1]?.onApplied();
+ expect(pendingNotificationNavigationId()).toBeUndefined();
+ });
+});
diff --git a/apps/web/src/features/notifications/PendingNotificationNavigationEffect.tsx b/apps/web/src/features/notifications/PendingNotificationNavigationEffect.tsx
index 54fabf6417..ef64a3f69a 100644
--- a/apps/web/src/features/notifications/PendingNotificationNavigationEffect.tsx
+++ b/apps/web/src/features/notifications/PendingNotificationNavigationEffect.tsx
@@ -1,4 +1,8 @@
import { globalSplitManager } from '@app/signal/splitLayout';
+import type {
+ SplitEventWithType,
+ SplitManager,
+} from '@components/app/split-layout/layoutManager';
import { toast } from '@core/component/Toast/Toast';
import {
type NotificationSource,
@@ -6,31 +10,107 @@ import {
pendingNotificationNavigationId,
setPendingNotificationNavigationId,
} from '@notifications';
-import { createEffect, on } from 'solid-js';
+import { createEffect, createSignal, onCleanup } from 'solid-js';
+
+type NavigationAttempt = {
+ notificationId: string;
+ layoutManager: SplitManager;
+ navigationVersion: number;
+ eventAtStart: SplitEventWithType | undefined;
+ settled: boolean;
+};
export function usePendingNotificationNavigationEffect(
notificationSource: NotificationSource
) {
- createEffect(
- on(
- [pendingNotificationNavigationId, globalSplitManager],
- ([notificationId, layoutManager]) => {
- if (!notificationId) return;
- if (!layoutManager) return;
+ const [retryRevision, setRetryRevision] = createSignal(0);
+ let disposed = false;
+ let activeAttempt: NavigationAttempt | undefined;
- setPendingNotificationNavigationId(undefined);
+ onCleanup(() => {
+ disposed = true;
+ activeAttempt = undefined;
+ });
+
+ createEffect(() => {
+ retryRevision();
+ const notificationId = pendingNotificationNavigationId();
+ const layoutManager = globalSplitManager();
+ const navigationReady = layoutManager?.contentNavigationReady() ?? false;
+ const navigationVersion = layoutManager?.contentNavigationVersion() ?? 0;
+ const currentEvent = layoutManager?.events();
+
+ if (!notificationId || !layoutManager || !navigationReady) {
+ activeAttempt = undefined;
+ return;
+ }
+
+ if (
+ activeAttempt?.notificationId === notificationId &&
+ activeAttempt.layoutManager === layoutManager &&
+ activeAttempt.navigationVersion === navigationVersion
+ ) {
+ // Do not overlap a fetch/open. Once it settles without being applied,
+ // retry only after reconciliation changes the live layout.
+ if (
+ !activeAttempt.settled ||
+ activeAttempt.eventAtStart === currentEvent
+ ) {
+ return;
+ }
+ }
+
+ const attempt: NavigationAttempt = {
+ notificationId,
+ layoutManager,
+ navigationVersion,
+ eventAtStart: currentEvent,
+ settled: false,
+ };
+ activeAttempt = attempt;
+
+ const isCurrentAttempt = () =>
+ !disposed &&
+ activeAttempt === attempt &&
+ pendingNotificationNavigationId() === notificationId &&
+ globalSplitManager() === layoutManager &&
+ layoutManager.contentNavigationReady() &&
+ layoutManager.contentNavigationVersion() === navigationVersion;
- void openNotificationFromId(
- notificationId,
- layoutManager,
- notificationSource
- ).match(
- () => {},
- () => {
- toast.failure('Failed to open notification.');
- }
- );
+ const onApplied = () => {
+ if (!isCurrentAttempt()) return;
+ activeAttempt = undefined;
+ setPendingNotificationNavigationId(undefined);
+ };
+
+ void openNotificationFromId(
+ notificationId,
+ layoutManager,
+ notificationSource,
+ { canOpen: isCurrentAttempt, onApplied }
+ ).match(
+ () => {
+ if (!isCurrentAttempt()) return;
+ attempt.settled = true;
+ if (layoutManager.events() !== attempt.eventAtStart) {
+ setRetryRevision((revision) => revision + 1);
+ }
+ },
+ (error) => {
+ if (activeAttempt !== attempt) return;
+ activeAttempt = undefined;
+ if (error.tag === 'NavigationDeferredError') return;
+ if (
+ disposed ||
+ pendingNotificationNavigationId() !== notificationId ||
+ globalSplitManager() !== layoutManager ||
+ layoutManager.contentNavigationVersion() !== navigationVersion
+ ) {
+ return;
+ }
+ setPendingNotificationNavigationId(undefined);
+ toast.failure('Failed to open notification.');
}
- )
- );
+ );
+ });
}
diff --git a/apps/web/src/features/notifications/notification-navigation.ts b/apps/web/src/features/notifications/notification-navigation.ts
index 10c89a6d34..5979718ce4 100644
--- a/apps/web/src/features/notifications/notification-navigation.ts
+++ b/apps/web/src/features/notifications/notification-navigation.ts
@@ -1,10 +1,12 @@
import { openCalendarView } from '@app/features/calendar-view/calendar-navigation';
import { createCalendarRange } from '@app/features/calendar-view/calendar-range';
+import { openReminderDetail } from '@app/features/reminders/reminder-navigation';
import {
getChannelParams,
navigateToChannelMessage,
} from '@block-channel/utils/link';
import type {
+ OpenSplitResult,
SplitHandle,
SplitManager,
} from '@components/app/split-layout/layoutManager';
@@ -13,15 +15,13 @@ import { resolveBlockAlias } from '@core/constant/allBlocks';
import {
enableCalendarUi,
enableProjects,
- enableReminders,
isFeatureEnabled,
USE_MACRO_PR_SUMMARY_BLOCK,
} from '@core/constant/featureFlags';
import { COMMENT_LINK_PARAM } from '@core/messages/comment-link';
-import type { EntityType, NotificationType } from '@core/types';
+import type { NotificationType } from '@core/types';
import { openExternalUrl } from '@core/util/url';
import { getNotificationById } from '@queries/notification/user-notifications';
-import { getReminderById } from '@queries/reminders/reminders';
import { errAsync, ResultAsync } from 'neverthrow';
import { match, P } from 'ts-pattern';
import { projectRouteId } from '../projects/core/route';
@@ -31,7 +31,6 @@ import {
} from './document-comment-location';
import { GITHUB_EVENT_TYPES } from './github-event-types';
import { isChannelNotification } from './notification-helpers';
-import { DefaultNotificationBlockNameResolver } from './notification-resolvers';
import type { NotificationSource } from './notification-source';
import { CHANNEL_EVENT_TYPES } from './notification-source';
import {
@@ -64,21 +63,37 @@ function openSplitIfNotOpen(
newSplit?: boolean;
params?: Record<string, unknown>;
sourceHandle?: SplitHandle;
+ onApplied?: VoidFunction;
} = {}
) {
+ let onApplied = options.onApplied;
+ const reportApplied = () => {
+ const callback = onApplied;
+ onApplied = undefined;
+ callback?.();
+ };
+ const reportImmediateResult = (result: OpenSplitResult | undefined) => {
+ if (!result) return;
+ if (result.status === 'opened' || result.status === 'reused') {
+ reportApplied();
+ }
+ };
const existing = layoutManager.getSplitByContent(type, id);
if (existing) {
existing.activate();
+ reportApplied();
} else {
- layoutManager.openWithSplit(
+ const result = layoutManager.openWithSplit(
{ type, id },
{
activate: true,
referredFrom: null,
preferNewSplit: options.newSplit,
handle: options.sourceHandle,
+ ...(options.onApplied ? { onApplied: reportApplied } : {}),
}
);
+ reportImmediateResult(result);
}
if (options.params && type !== 'component') {
goToLocationInSplit(layoutManager, type, id, options.params);
@@ -125,7 +140,8 @@ async function openChannelNotification(
notification: UnifiedNotification,
layoutManager: SplitManager,
newSplit: boolean = false,
- sourceHandle?: SplitHandle
+ sourceHandle?: SplitHandle,
+ onApplied?: VoidFunction
) {
const channelId = notification.entity_id;
const { messageId, threadId } = getChannelNotificationParams(notification);
@@ -134,6 +150,7 @@ async function openChannelNotification(
openSplitIfNotOpen(layoutManager, 'channel', channelId, {
newSplit,
sourceHandle,
+ onApplied,
});
return;
}
@@ -143,6 +160,7 @@ async function openChannelNotification(
splitManager: layoutManager,
preferNewSplit: newSplit,
sourceHandle,
+ ...(onApplied ? { onApplied } : {}),
});
}
@@ -156,12 +174,21 @@ type NotFoundError = {
notificationId: string;
};
-type OpenNotificationFromIdError = NotSupportedError | NotFoundError;
+type NavigationDeferredError = {
+ tag: 'NavigationDeferredError';
+ notificationId: string;
+};
+
+type OpenNotificationFromIdError =
+ | NotSupportedError
+ | NotFoundError
+ | NavigationDeferredError;
function getSupportedHandler(
notification: UnifiedNotification,
entity?: NotificationEntityOverride,
- sourceHandle?: SplitHandle
+ sourceHandle?: SplitHandle,
+ onApplied?: VoidFunction
): ((layoutManager: SplitManager, newSplit?: boolean) => Promise<void>) | null {
const tag = notification.notification_metadata.tag as NotificationType;
@@ -171,7 +198,13 @@ function getSupportedHandler(
P.union(...CHANNEL_EVENT_TYPES),
() =>
(lm: SplitManager, newSplit: boolean = false) =>
- openChannelNotification(notification, lm, newSplit, sourceHandle)
+ openChannelNotification(
+ notification,
+ lm,
+ newSplit,
+ sourceHandle,
+ onApplied
+ )
)
.with(
'ai_response',
@@ -180,6 +213,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'chat', notification.entity_id, {
newSplit,
sourceHandle,
+ onApplied,
})
)
.with('new_email', () => {
@@ -189,6 +223,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'email', meta.content.threadId, {
newSplit,
sourceHandle,
+ onApplied,
});
};
})
@@ -199,6 +234,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'channel', notification.entity_id, {
newSplit,
sourceHandle,
+ onApplied,
})
)
.with('invite_to_team', () => null)
@@ -209,6 +245,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'channel', notification.entity_id, {
newSplit,
sourceHandle,
+ onApplied,
})
)
// Every agent-session kind opens the session itself: the chip in the
@@ -233,6 +270,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'agent', meta.content.sessionId, {
newSplit,
sourceHandle,
+ onApplied,
});
};
}
@@ -244,6 +282,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'task', meta.content.taskId, {
newSplit,
sourceHandle,
+ onApplied,
});
};
})
@@ -264,6 +303,7 @@ function getSupportedHandler(
openSplitIfNotOpen(lm, 'pr', notification.entity_id, {
newSplit,
sourceHandle,
+ onApplied,
});
return;
}
@@ -274,6 +314,7 @@ function getSupportedHandler(
}
openExternalUrl(url);
+ onApplied?.();
};
})
.with('initiative_discussion', () => {
@@ -293,7 +334,7 @@ function getSupportedHandler(
section: 'overview',
discussionId: meta.content.messageId,
}),
- { newSplit, sourceHandle }
+ { newSplit, sourceHandle, onApplied }
);
};
})
@@ -312,32 +353,17 @@ function getSupportedHandler(
newSplit,
params: location.params,
sourceHandle,
+ onApplied,
});
}
)
.with('reminder', () => {
- // The notification points at the reminder itself, so there is nothing to
- // open until the reminder is fetched and its referenced entity read. A
- // standalone reminder references nothing and opens nothing.
return async (lm: SplitManager, newSplit: boolean = false) => {
- // A reminder created before the flag closed still has a live
- // notification; opening it would reach reminder surfaces the user is
- // no longer meant to have.
- if (!isFeatureEnabled(enableReminders)) return;
- const reminder = await getReminderById(notification.entity_id);
- const entityType = reminder?.entityType;
- const entityId = reminder?.entityId;
- if (!entityType || !entityId) return;
-
- const blockName = await DefaultNotificationBlockNameResolver(
- entityId,
- entityType as EntityType
- );
- if (!blockName) return;
-
- openSplitIfNotOpen(lm, blockName, entityId, {
- newSplit,
- sourceHandle,
+ openReminderDetail(notification.entity_id, {
+ manager: lm,
+ handle: sourceHandle,
+ openInNewSplit: newSplit,
+ ...(onApplied ? { onApplied } : {}),
});
};
})
@@ -349,7 +375,10 @@ function getSupportedHandler(
// A reminder delivered before the flag closed still has a live
// notification; opening it must not reach a surface the user is no
// longer meant to have.
- if (!isFeatureEnabled(enableCalendarUi)) return;
+ if (!isFeatureEnabled(enableCalendarUi)) {
+ onApplied?.();
+ return;
+ }
const content = meta.content;
const time = content.startsAt
? {
@@ -371,6 +400,7 @@ function getSupportedHandler(
manager: lm,
handle: sourceHandle,
openInNewSplit: newSplit,
+ ...(onApplied ? { onApplied } : {}),
}
);
};
@@ -385,6 +415,7 @@ function getSupportedHandler(
newSplit,
params: { [COMMENT_LINK_PARAM]: meta.content.messageId },
sourceHandle,
+ onApplied,
});
})
.with('inbox_reauth_required', () => null)
@@ -405,9 +436,15 @@ export function openNotification(
* The split this navigation originates from (e.g. the list whose row was
* clicked).
*/
- sourceHandle?: SplitHandle
+ sourceHandle?: SplitHandle,
+ options: { onApplied?: VoidFunction } = {}
): ResultAsync<void, NotSupportedError> {
- const handler = getSupportedHandler(notification, entity, sourceHandle);
+ const handler = getSupportedHandler(
+ notification,
+ entity,
+ sourceHandle,
+ options.onApplied
+ );
if (!handler) {
return errAsync({
tag: 'NotSupportedError',
@@ -439,14 +476,32 @@ export function openSingleStackNotification(
export function openNotificationFromId(
notificationId: string,
layoutManager: SplitManager,
- notificationSource: NotificationSource
+ notificationSource: NotificationSource,
+ options: { canOpen?: () => boolean; onApplied?: VoidFunction } = {}
): ResultAsync<void, OpenNotificationFromIdError> {
+ const openIfReady = (notification: UnifiedNotification) => {
+ if (options.canOpen && !options.canOpen()) {
+ return errAsync({
+ tag: 'NavigationDeferredError' as const,
+ notificationId,
+ });
+ }
+ return openNotification(
+ notification,
+ layoutManager,
+ false,
+ undefined,
+ undefined,
+ { onApplied: options.onApplied }
+ );
+ };
+
// Check notification source first
const cached = notificationSource
.notifications()
.find((n) => n.id === notificationId);
if (cached) {
- return openNotification(cached, layoutManager);
+ return openIfReady(cached);
}
// Fetch if not in notification source
@@ -457,6 +512,6 @@ export function openNotificationFromId(
const err: NotFoundError = { tag: 'NotFoundError', notificationId };
return errAsync(err);
}
- return openNotification(unified, layoutManager);
+ return openIfReady(unified);
});
}
diff --git a/apps/web/src/features/notifications/notification-platform.ts b/apps/web/src/features/notifications/notification-platform.ts
index d6818720e8..aedfd0c049 100644
--- a/apps/web/src/features/notifications/notification-platform.ts
+++ b/apps/web/src/features/notifications/notification-platform.ts
@@ -74,6 +74,22 @@ export async function toPlatformNotificationData(
resolveUserName: UserNameResolver,
resolveDocumentName: DocumentNameResolver
): Promise<PlatformNotificationData | null> {
+ const accentColor = getAccentColorForIcon();
+ const icon = getFaviconUrl(accentColor);
+ const metadata = notification.notification_metadata;
+
+ // A reminder is self-authored and points at its own detail resource. Do not
+ // manufacture an actor/target sentence or resolve its id as a document.
+ if (metadata.tag === 'reminder') {
+ return {
+ title: 'Reminder',
+ options: {
+ body: markdownToPlainText(metadata.content.description),
+ icon,
+ },
+ };
+ }
+
const actor =
(await resolveActorName(notification, resolveUserName)) ??
USER_NAME_FALLBACK;
@@ -90,9 +106,6 @@ export async function toPlatformNotificationData(
const content = getNotificationContent(notification);
const action = getNotificationAction(notification);
- const accentColor = getAccentColorForIcon();
- const icon = getFaviconUrl(accentColor);
-
return {
title: `${actor}${showTarget ? ` <${targetName}>` : ''}`,
options: {
diff --git a/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts b/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts
index 8f36a3f8a3..bf9d068e4d 100644
--- a/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts
+++ b/apps/web/src/features/notifications/tests/channel-notification-navigation.test.ts
@@ -158,6 +158,26 @@ it.each(['channel_invite', 'call_started'] as const)(
}
);
+it('reports an ordinary channel notification applied after preview activation', async () => {
+ const { layout, activate } = setup('preview');
+ const onApplied = vi.fn();
+
+ await openNotification(
+ {
+ entity_id: 'channel',
+ notification_metadata: { tag: 'channel_invite', content: {} },
+ } as UnifiedNotification,
+ layout,
+ false,
+ undefined,
+ undefined,
+ { onApplied }
+ );
+
+ expect(activate).toHaveBeenCalledOnce();
+ expect(onApplied).toHaveBeenCalledOnce();
+});
+
it.each(['split', 'closed'] as const)(
'preserves notification navigation when the channel is %s',
async (location) => {
diff --git a/apps/web/src/features/notifications/tests/notification-platform.test.ts b/apps/web/src/features/notifications/tests/notification-platform.test.ts
index c80b3fe0a6..f6d442253d 100644
--- a/apps/web/src/features/notifications/tests/notification-platform.test.ts
+++ b/apps/web/src/features/notifications/tests/notification-platform.test.ts
@@ -141,6 +141,21 @@ function createAgentSettledNotification(): UnifiedNotification {
});
}
+function createReminderNotification(): UnifiedNotification {
+ return baseNotification({
+ entity_id: 'reminder-1',
+ entity_type: 'reminder',
+ notification_event_type: 'reminder',
+ notification_metadata: {
+ tag: 'reminder',
+ content: {
+ description: '**Review** the reminder flow',
+ reminderId: 'reminder-1',
+ },
+ },
+ });
+}
+
function createNotificationInterface(
showNotification: PlatformNotificationState['showNotification']
): PlatformNotificationState {
@@ -161,6 +176,27 @@ function createNotificationHandle(): PlatformNotificationHandle {
}
describe('maybeHandlePlatformNotification', () => {
+ it('formats a sender-less reminder without actor or document resolution', async () => {
+ const resolveUserName = vi.fn(async () => 'Unexpected actor');
+ const resolveDocumentName = vi.fn(async () => 'Unexpected document');
+
+ const result = await toPlatformNotificationData(
+ createReminderNotification(),
+ resolveUserName,
+ resolveDocumentName
+ );
+
+ expect(result).toEqual({
+ title: 'Reminder',
+ options: {
+ body: '**Review** the reminder flow',
+ icon: 'favicon.ico',
+ },
+ });
+ expect(resolveUserName).not.toHaveBeenCalled();
+ expect(resolveDocumentName).not.toHaveBeenCalled();
+ });
+
it('skips GitHub PR events so they do not render as browser notifications', async () => {
const showNotification = vi.fn<
PlatformNotificationState['showNotification']
diff --git a/apps/web/src/features/notifications/tests/reminder-navigation.test.ts b/apps/web/src/features/notifications/tests/reminder-navigation.test.ts
new file mode 100644
index 0000000000..12bf919881
--- /dev/null
+++ b/apps/web/src/features/notifications/tests/reminder-navigation.test.ts
@@ -0,0 +1,155 @@
+vi.mock('../notification-helpers', () => ({
+ isChannelNotification: () => false,
+}));
+vi.mock('../notification-source', () => ({
+ CHANNEL_EVENT_TYPES: [
+ 'channel_mention',
+ 'channel_message_send',
+ 'channel_message_reply',
+ 'document_mention',
+ ],
+}));
+vi.mock('../notification-stacking', () => ({
+ getMostRecentNotification: vi.fn(),
+ stackNotifications: vi.fn(),
+}));
+
+const flags = vi.hoisted(() => ({ reminders: true }));
+const openReminderDetail = vi.hoisted(() => vi.fn());
+const getNotificationById = vi.hoisted(() => vi.fn());
+
+vi.mock('@app/features/reminders/reminder-navigation', () => ({
+ openReminderDetail,
+}));
+
+vi.mock('@app/features/calendar-view/calendar-range', () => ({
+ createCalendarRange: vi.fn(),
+}));
+vi.mock('@block-channel/utils/link', () => ({
+ getChannelParams: vi.fn(),
+ navigateToChannelMessage: vi.fn(),
+}));
+vi.mock('@core/constant/allBlocks', () => ({
+ itemToBlockName: (value: { fileType: string }) => value.fileType,
+ resolveBlockAlias: (type: string) => type,
+}));
+vi.mock('@core/constant/featureFlags', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@core/constant/featureFlags')>()),
+ enableCalendarUi: { key: 'enable-calendar-ui' },
+ enableReminders: { key: 'enable-reminders' },
+ isFeatureEnabled: (flag: { key: string }) =>
+ flag.key === 'enable-reminders' && flags.reminders,
+ USE_MACRO_PR_SUMMARY_BLOCK: true,
+}));
+vi.mock('@core/util/url', () => ({
+ buildSimpleEntityUrl: ({ type, id }: { type: string; id: string }) =>
+ `https://macro.com/app/${type}/${id}`,
+ openExternalUrl: vi.fn(),
+}));
+vi.mock('@queries/notification/user-notifications', () => ({
+ getNotificationById,
+}));
+
+import type { SplitManager } from '@components/app/split-layout/layoutManager';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import {
+ openNotification,
+ openNotificationFromId,
+} from '../notification-navigation';
+import type { NotificationSource } from '../notification-source';
+import type { UnifiedNotification } from '../types';
+
+function reminderNotification(): UnifiedNotification {
+ return {
+ entity_id: 'reminder-1',
+ notification_event_type: 'reminder',
+ notification_metadata: {
+ tag: 'reminder',
+ content: {
+ description: 'Review the reminder navigation',
+ reminderId: 'reminder-1',
+ },
+ },
+ } as UnifiedNotification;
+}
+
+describe('reminder notification navigation', () => {
+ beforeEach(() => {
+ flags.reminders = true;
+ openReminderDetail.mockClear();
+ getNotificationById.mockReset();
+ });
+
+ it('opens source-less reminders through their claimed detail route', async () => {
+ const getOrchestrator = vi.fn();
+ const layout = {
+ getOrchestrator,
+ } as unknown as SplitManager;
+
+ const result = await openNotification(reminderNotification(), layout);
+
+ expect(result.isOk()).toBe(true);
+ expect(openReminderDetail).toHaveBeenCalledExactlyOnceWith('reminder-1', {
+ manager: layout,
+ handle: undefined,
+ openInNewSplit: false,
+ });
+ expect(getOrchestrator).not.toHaveBeenCalled();
+ });
+
+ it('defers feature enforcement to the reactive destination route', async () => {
+ flags.reminders = false;
+ const layout = {} as SplitManager;
+
+ await openNotification(reminderNotification(), layout);
+
+ expect(openReminderDetail).toHaveBeenCalledExactlyOnceWith('reminder-1', {
+ manager: layout,
+ handle: undefined,
+ openInNewSplit: false,
+ });
+ });
+
+ it('forwards acceptance so startup intent clears only after route apply', async () => {
+ const layout = {} as SplitManager;
+ const onApplied = vi.fn();
+
+ await openNotification(
+ reminderNotification(),
+ layout,
+ false,
+ undefined,
+ undefined,
+ { onApplied }
+ );
+
+ expect(openReminderDetail).toHaveBeenCalledExactlyOnceWith('reminder-1', {
+ manager: layout,
+ handle: undefined,
+ openInNewSplit: false,
+ onApplied,
+ });
+ expect(onApplied).not.toHaveBeenCalled();
+ });
+
+ it('does not open a fetched reminder after its route host becomes stale', async () => {
+ const notification = reminderNotification();
+ getNotificationById.mockResolvedValue(notification);
+ const layout = {} as SplitManager;
+ const source = { notifications: () => [] } as unknown as NotificationSource;
+
+ const result = await openNotificationFromId(
+ 'notification-1',
+ layout,
+ source,
+ { canOpen: () => false }
+ );
+
+ expect(result.isErr()).toBe(true);
+ expect(result._unsafeUnwrapErr()).toEqual({
+ tag: 'NavigationDeferredError',
+ notificationId: 'notification-1',
+ });
+ expect(openReminderDetail).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/features/reminders/ReminderEditorSplit.lifecycle.test.tsx b/apps/web/src/features/reminders/ReminderEditorSplit.lifecycle.test.tsx
new file mode 100644
index 0000000000..df6c852b70
--- /dev/null
+++ b/apps/web/src/features/reminders/ReminderEditorSplit.lifecycle.test.tsx
@@ -0,0 +1,108 @@
+const state = vi.hoisted(() => ({
+ queryFor: (_id: string | undefined) => undefined as Reminder | undefined,
+ mutationInstances: 0,
+}));
+
+vi.mock('@app/features/calendar/hooks/use-calendar-ui-flag', () => ({
+ useCalendarUiFlag: () => () => true,
+}));
+vi.mock('@app/features/calendar-view/open-calendar-event', () => ({
+ openCalendarEventSplit: vi.fn(),
+}));
+vi.mock('@components/app/split-layout/layoutUtils', () => ({
+ useSplitPanelOrThrow: vi.fn(),
+}));
+vi.mock('@core/component/ItemPreview', () => ({
+ ItemPreview: () => null,
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: vi.fn(), failure: vi.fn() },
+}));
+vi.mock('@queries/reminders/reminders', () => ({
+ reminderSoupPatch: vi.fn(),
+ useReminderQuery: (id: () => string | undefined) => ({
+ get data() {
+ return state.queryFor(id());
+ },
+ get isSuccess() {
+ return state.queryFor(id()) !== undefined;
+ },
+ isPending: false,
+ isError: false,
+ }),
+ useUpdateReminderMutation: () => {
+ state.mutationInstances += 1;
+ return { isPending: false, mutateAsync: vi.fn() };
+ },
+}));
+vi.mock('@queries/soup/cache', () => ({
+ getSoupEntityById: vi.fn(),
+ optimisticUpdateSoupEntity: vi.fn(),
+}));
+
+import type { Reminder } from '@service-storage/generated/schemas/reminder';
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { ReminderDetails } from './ReminderEditorSplit';
+
+class ResizeObserverStub {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+
+function reminder(id: string, description: string): Reminder {
+ return {
+ id,
+ description,
+ schedule: { type: 'once', remindAt: '2027-09-22T09:00:00Z' },
+ nextRunAt: '2027-09-22T09:00:00Z',
+ enabled: true,
+ completedAt: null,
+ createdAt: '2026-09-21T09:00:00Z',
+ updatedAt: '2026-09-21T09:00:00Z',
+ } as Reminder;
+}
+
+beforeEach(() => {
+ vi.stubGlobal('ResizeObserver', ResizeObserverStub);
+ state.mutationInstances = 0;
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+it('keeps a same-reminder draft but resets controller state for cached A-to-B navigation', () => {
+ const [cache, setCache] = createSignal<Record<string, Reminder>>({
+ 'reminder-a': reminder('reminder-a', 'Reminder A'),
+ 'reminder-b': reminder('reminder-b', 'Reminder B'),
+ });
+ state.queryFor = (id) => (id ? cache()[id] : undefined);
+ const [reminderId, setReminderId] = createSignal<string | undefined>(
+ 'reminder-a'
+ );
+ const view = render(() => (
+ <ReminderDetails reminderId={reminderId()} onClose={() => {}} />
+ ));
+ const title = view.getByPlaceholderText('Reminder description');
+
+ fireEvent.input(title, { target: { value: 'Unsaved A draft' } });
+ setCache((current) => ({
+ ...current,
+ 'reminder-a': reminder('reminder-a', 'Refetched Reminder A'),
+ }));
+
+ expect(view.getByPlaceholderText('Reminder description')).toBe(title);
+ expect((title as HTMLInputElement).value).toBe('Unsaved A draft');
+ expect(state.mutationInstances).toBe(1);
+
+ setReminderId('reminder-b');
+
+ const nextTitle = view.getByPlaceholderText('Reminder description');
+ expect(nextTitle).not.toBe(title);
+ expect((nextTitle as HTMLInputElement).value).toBe('Reminder B');
+ expect(state.mutationInstances).toBe(2);
+});
diff --git a/apps/web/src/features/reminders/ReminderEditorSplit.test.tsx b/apps/web/src/features/reminders/ReminderEditorSplit.test.tsx
new file mode 100644
index 0000000000..3dcb2044af
--- /dev/null
+++ b/apps/web/src/features/reminders/ReminderEditorSplit.test.tsx
@@ -0,0 +1,233 @@
+const state = vi.hoisted(() => ({
+ query: {} as Record<string, unknown>,
+ itemPreview: vi.fn(),
+ calendarEnabled: true,
+ openCalendarEvent: vi.fn(),
+ mutateAsync: vi.fn(),
+ editPatch: vi.fn(),
+}));
+
+vi.mock('@app/features/calendar/hooks/use-calendar-ui-flag', () => ({
+ useCalendarUiFlag: () => () => state.calendarEnabled,
+}));
+vi.mock('@app/features/calendar-view/open-calendar-event', () => ({
+ openCalendarEventSplit: state.openCalendarEvent,
+}));
+vi.mock('@components/app/split-layout/layoutUtils', () => ({
+ useSplitPanelOrThrow: vi.fn(),
+}));
+vi.mock('@core/component/ItemPreview', () => ({
+ ItemPreview: (props: { id: string; type: string }) => {
+ state.itemPreview(props);
+ return <div data-testid="source-fallback">Original item unavailable</div>;
+ },
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: vi.fn(), failure: vi.fn() },
+}));
+vi.mock('@queries/reminders/reminders', () => ({
+ reminderSoupPatch: vi.fn(),
+ useReminderQuery: () => state.query,
+ useUpdateReminderMutation: () => ({
+ isPending: false,
+ mutateAsync: state.mutateAsync,
+ }),
+}));
+vi.mock('@queries/soup/cache', () => ({
+ getSoupEntityById: vi.fn(),
+ optimisticUpdateSoupEntity: vi.fn(),
+}));
+vi.mock('./ReminderForm', () => ({
+ ReminderForm: (props: {
+ reference?: import('solid-js').JSX.Element;
+ onSubmit: (values: unknown) => void;
+ }) => (
+ <div data-testid="reminder-form">
+ {props.reference}
+ <button
+ type="button"
+ onClick={() =>
+ props.onSubmit({
+ description: 'Updated reminder',
+ schedule: { type: 'once', remindAt: '2026-09-23T09:00:00Z' },
+ })
+ }
+ >
+ Save fixture
+ </button>
+ </div>
+ ),
+}));
+vi.mock('./reminder-schedule', () => ({
+ reminderEditPatch: state.editPatch,
+ resolveEditedDescription: (description: string) => description,
+}));
+
+import type { Reminder } from '@service-storage/generated/schemas/reminder';
+import { cleanup, fireEvent, render } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ReminderDetails } from './ReminderEditorSplit';
+
+function reminder(overrides: Partial<Reminder> = {}): Reminder {
+ return {
+ id: 'reminder-1',
+ description: 'Review reminder details',
+ schedule: { type: 'once', remindAt: '2026-09-22T09:00:00Z' },
+ nextRunAt: '2026-09-22T09:00:00Z',
+ enabled: true,
+ completedAt: null,
+ createdAt: '2026-09-21T09:00:00Z',
+ updatedAt: '2026-09-21T09:00:00Z',
+ ...overrides,
+ } as Reminder;
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ state.calendarEnabled = true;
+ state.editPatch.mockReturnValue({ description: 'Updated reminder' });
+ state.mutateAsync.mockResolvedValue(reminder());
+ state.query = {
+ data: reminder(),
+ isSuccess: true,
+ isPending: false,
+ isError: false,
+ };
+});
+
+afterEach(cleanup);
+
+describe('ReminderDetails', () => {
+ it('renders standalone reminder details without treating the reminder as a source', () => {
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={() => {}} />
+ ));
+
+ expect(view.getByTestId('reminder-form')).toBeTruthy();
+ expect(state.itemPreview).not.toHaveBeenCalled();
+ });
+
+ it('uses only the attached source identity for deliberate source navigation', () => {
+ state.query = {
+ data: reminder({ entityId: 'document-1', entityType: 'document' }),
+ isSuccess: true,
+ isPending: false,
+ isError: false,
+ };
+
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={() => {}} />
+ ));
+
+ expect(view.getByText('Original item')).toBeTruthy();
+ expect(view.getByTestId('source-fallback')).toBeTruthy();
+ expect(state.itemPreview).toHaveBeenCalledExactlyOnceWith({
+ id: 'document-1',
+ type: 'document',
+ });
+ });
+
+ it('opens an attached calendar event through the gated calendar destination', () => {
+ state.query = {
+ data: reminder({
+ entityId: 'calendar-event-1',
+ entityType: 'calendar_event',
+ }),
+ isSuccess: true,
+ isPending: false,
+ isError: false,
+ };
+
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={() => {}} />
+ ));
+ fireEvent.click(view.getByRole('button', { name: 'Open calendar event' }));
+
+ expect(state.openCalendarEvent).toHaveBeenCalledExactlyOnceWith({
+ eventId: 'calendar-event-1',
+ });
+ expect(state.itemPreview).not.toHaveBeenCalled();
+ });
+
+ it('hides an attached calendar event action while calendar is disabled', () => {
+ state.calendarEnabled = false;
+ state.query = {
+ data: reminder({
+ entityId: 'calendar-event-1',
+ entityType: 'calendar_event',
+ }),
+ isSuccess: true,
+ isPending: false,
+ isError: false,
+ };
+
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={() => {}} />
+ ));
+
+ expect(
+ view.queryByRole('button', { name: 'Open calendar event' })
+ ).toBeNull();
+ expect(state.openCalendarEvent).not.toHaveBeenCalled();
+ });
+
+ it('does not close a replacement reminder after an earlier save resolves', async () => {
+ let resolveUpdate!: (value: Reminder) => void;
+ state.mutateAsync.mockReturnValue(
+ new Promise<Reminder>((resolve) => {
+ resolveUpdate = resolve;
+ })
+ );
+ const [reminderId, setReminderId] = createSignal<string | undefined>(
+ 'reminder-1'
+ );
+ const onClose = vi.fn();
+ const view = render(() => (
+ <ReminderDetails reminderId={reminderId()} onClose={onClose} />
+ ));
+
+ fireEvent.click(view.getByRole('button', { name: 'Save fixture' }));
+ expect(state.mutateAsync).toHaveBeenCalledOnce();
+ setReminderId('reminder-2');
+ resolveUpdate(reminder());
+ await Promise.resolve();
+ await Promise.resolve();
+
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ it('closes the same reminder after its save resolves', async () => {
+ const onClose = vi.fn();
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={onClose} />
+ ));
+
+ fireEvent.click(view.getByRole('button', { name: 'Save fixture' }));
+ await Promise.resolve();
+ await Promise.resolve();
+
+ expect(onClose).toHaveBeenCalledOnce();
+ });
+
+ it('renders a useful fallback for a missing or inaccessible reminder', () => {
+ state.query = {
+ data: undefined,
+ isSuccess: false,
+ isPending: false,
+ isError: true,
+ };
+
+ const view = render(() => (
+ <ReminderDetails reminderId="reminder-1" onClose={() => {}} />
+ ));
+
+ expect(
+ view.getByText(
+ 'This reminder is unavailable or you no longer have access.'
+ )
+ ).toBeTruthy();
+ expect(view.queryByTestId('reminder-form')).toBeNull();
+ expect(state.itemPreview).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/features/reminders/ReminderEditorSplit.tsx b/apps/web/src/features/reminders/ReminderEditorSplit.tsx
index 5652e7f232..996df20bc6 100644
--- a/apps/web/src/features/reminders/ReminderEditorSplit.tsx
+++ b/apps/web/src/features/reminders/ReminderEditorSplit.tsx
@@ -1,8 +1,14 @@
-import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';
+import { openCalendarEventSplit } from '@app/features/calendar-view/open-calendar-event';
+import {
+ useSplitDisplayName,
+ useSplitPanelOrThrow,
+} from '@components/app/split-layout/layoutUtils';
import { ItemPreview } from '@core/component/ItemPreview';
import { toast } from '@core/component/Toast/Toast';
import type { ReminderEntity } from '@entity';
import BellIcon from '@phosphor/bell-simple.svg';
+import CalendarBlankIcon from '@phosphor/calendar-blank.svg';
import SpinnerIcon from '@phosphor/spinner.svg';
import {
reminderSoupPatch,
@@ -14,7 +20,8 @@ import {
optimisticUpdateSoupEntity,
} from '@queries/soup/cache';
import type { Reminder } from '@service-storage/generated/schemas/reminder';
-import { createMemo, Match, onMount, Show, Switch } from 'solid-js';
+import { Button } from '@ui';
+import { createMemo, Match, onCleanup, Show, Switch } from 'solid-js';
import { ReminderForm, type ReminderFormValues } from './ReminderForm';
import {
reminderEditPatch,
@@ -56,18 +63,57 @@ function referenceMention(
}
/**
- * The reminder editor, hosted in a split so it previews into the Viewer like any
- * other entity rather than a modal over the list.
+ * Props shared by split and inline-preview reminder detail adapters.
*
- * It fetches the reminder by id (the id is encoded in the split content, so it
+ * The host owns close/navigation behavior so the editor content does not need
+ * to know whether it is mounted as a restorable split or Home's detail pane.
+ */
+export type ReminderDetailsProps = {
+ reminderId: string | undefined;
+ onClose: VoidFunction;
+};
+
+function ReminderUnavailable() {
+ return (
+ <div class="flex flex-col items-center justify-center gap-2 py-16 text-ink-muted">
+ <BellIcon class="size-6 text-ink-extra-muted" />
+ <span class="text-center text-sm">
+ This reminder is unavailable or you no longer have access.
+ </span>
+ </div>
+ );
+}
+
+/**
+ * Reminder detail content shared by the restorable component split and Home's
+ * inline preview.
+ *
+ * It fetches the reminder by id (the id comes from the typed route, so it
* survives a reload), seeds the shared {@link ReminderForm}, and shows the
* entity the reminder is about as a preview card. Saving writes through the same
- * mutation the create modal uses and closes the split.
+ * mutation the create modal uses and asks its host to close.
*/
-export function ReminderEditorSplit(props: { reminderId: string }) {
- const panel = useSplitPanelOrThrow();
- onMount(() => panel.handle.setDisplayName('Reminder'));
+export function ReminderDetails(props: ReminderDetailsProps) {
+ return (
+ <Show when={props.reminderId} keyed fallback={<ReminderUnavailable />}>
+ {(reminderId) => (
+ <ReminderDetailsForId reminderId={reminderId} onClose={props.onClose} />
+ )}
+ </Show>
+ );
+}
+
+/** One keyed editor lifecycle, recreated whenever the selected reminder changes. */
+function ReminderDetailsForId(props: {
+ reminderId: string;
+ onClose: VoidFunction;
+}) {
+ let active = true;
+ onCleanup(() => {
+ active = false;
+ });
+ const calendarUiEnabled = useCalendarUiFlag();
const query = useReminderQuery(() => props.reminderId);
// Soup rows come from the normalized soup cache, not the reminders queries, so
@@ -85,9 +131,17 @@ export function ReminderEditorSplit(props: { reminderId: string }) {
});
const reference = createMemo(() => {
- const reminder = query.data;
- return reminder ? referenceMention(reminder) : undefined;
+ if (!query.isSuccess) return undefined;
+ return referenceMention(query.data);
});
+ const calendarEventId = createMemo(() => {
+ if (!query.isSuccess || query.data.entityType !== 'calendar_event') {
+ return undefined;
+ }
+ return query.data.entityId;
+ });
+ const reminderUnavailable = () =>
+ query.isError || (query.isSuccess && query.data === undefined);
const save = async (values: ReminderFormValues, reminder: Reminder) => {
const patch = reminderEditPatch(
@@ -112,14 +166,17 @@ export function ReminderEditorSplit(props: { reminderId: string }) {
);
// Neither answer moved — nothing to send, and an empty patch is rejected.
if (!patch) {
- panel.handle.close();
+ props.onClose();
return;
}
+ const submittedReminderId = reminder.id;
try {
await updateReminder.mutateAsync({ id: reminder.id, patch });
+ if (!active || props.reminderId !== submittedReminderId) return;
toast.success('Reminder updated');
- panel.handle.close();
+ props.onClose();
} catch {
+ if (!active || props.reminderId !== submittedReminderId) return;
toast.failure('Failed to update reminder');
}
};
@@ -128,7 +185,7 @@ export function ReminderEditorSplit(props: { reminderId: string }) {
<div class="h-full min-h-0 overflow-y-auto bg-panel font-sans">
<div class="mx-auto w-full max-w-xl p-6">
<Switch>
- <Match when={query.data}>
+ <Match when={query.isSuccess ? query.data : undefined}>
{(reminder) => (
<ReminderForm
initialDescription={reminder().description}
@@ -138,37 +195,79 @@ export function ReminderEditorSplit(props: { reminderId: string }) {
submitLabel="Save"
pending={updateReminder.isPending}
reference={
- <Show when={reference()}>
- {(ref) => (
- <div class="flex">
- <ItemPreview id={ref().id} type={ref().type} />
- </div>
- )}
- </Show>
+ <>
+ <Show when={reference()}>
+ {(ref) => (
+ <div class="flex flex-col gap-1">
+ <span class="text-xs font-medium text-ink-muted">
+ Original item
+ </span>
+ <div class="flex">
+ <ItemPreview id={ref().id} type={ref().type} />
+ </div>
+ </div>
+ )}
+ </Show>
+ <Show
+ when={calendarUiEnabled() ? calendarEventId() : undefined}
+ >
+ {(eventId) => (
+ <div class="flex flex-col gap-1">
+ <span class="text-xs font-medium text-ink-muted">
+ Original item
+ </span>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ class="self-start"
+ onClick={() =>
+ void openCalendarEventSplit({
+ eventId: eventId(),
+ })
+ }
+ >
+ <CalendarBlankIcon class="size-4" />
+ Open calendar event
+ </Button>
+ </div>
+ )}
+ </Show>
+ </>
}
revertOnCancel
onCancel={(wasDirty) => {
// Reverting an edit keeps the panel open; a clean cancel
// dismisses the preview.
- if (!wasDirty) panel.handle.close();
+ if (!wasDirty) props.onClose();
}}
onSubmit={(values) => void save(values, reminder())}
/>
)}
</Match>
- <Match when={query.isLoading}>
+ <Match when={query.isPending}>
<div class="flex items-center justify-center py-16 text-ink-muted">
<SpinnerIcon class="size-5 animate-spin" />
</div>
</Match>
- <Match when={query.isError || !query.data}>
- <div class="flex flex-col items-center justify-center gap-2 py-16 text-ink-muted">
- <BellIcon class="size-6 text-ink-extra-muted" />
- <span class="text-sm">This reminder is no longer available.</span>
- </div>
+ <Match when={reminderUnavailable()}>
+ <ReminderUnavailable />
</Match>
</Switch>
</div>
</div>
);
}
+
+/** Restorable split adapter for {@link ReminderDetails}. */
+export function ReminderEditorSplit(props: { reminderId: string | undefined }) {
+ const panel = useSplitPanelOrThrow();
+ useSplitDisplayName(() => 'Reminder');
+
+ return (
+ <ReminderDetails
+ reminderId={props.reminderId}
+ onClose={() => panel.handle.close()}
+ />
+ );
+}
diff --git a/apps/web/src/features/reminders/reminder-navigation.test.ts b/apps/web/src/features/reminders/reminder-navigation.test.ts
new file mode 100644
index 0000000000..375d433e4c
--- /dev/null
+++ b/apps/web/src/features/reminders/reminder-navigation.test.ts
@@ -0,0 +1,134 @@
+import { setGlobalSplitManager } from '@app/signal/splitLayout';
+import type {
+ SplitHandle,
+ SplitManager,
+} from '@components/app/split-layout/layoutManager';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import {
+ HOME_REMINDER_DETAIL_ROUTE_ID,
+ openReminderDetail,
+ REMINDER_DETAIL_COMPONENT_ID,
+ REMINDER_DETAIL_ROUTE_ID,
+ reminderDetailDestination,
+ reminderDetailPath,
+ reminderDetailUrl,
+ reminderIdFromDetailContent,
+} from './reminder-navigation';
+
+afterEach(() => setGlobalSplitManager(undefined));
+
+describe('reminder detail destination', () => {
+ it('uses a canonical route while retaining route-backed split content', () => {
+ const destination = reminderDetailDestination('reminder-1');
+
+ expect(destination).toEqual({
+ kind: 'reminder-detail',
+ reminderId: 'reminder-1',
+ content: {
+ type: 'component',
+ id: REMINDER_DETAIL_COMPONENT_ID,
+ params: { reminderId: 'reminder-1' },
+ entryMetadata: {
+ route: {
+ matches: [
+ {
+ id: REMINDER_DETAIL_ROUTE_ID,
+ params: { reminderId: 'reminder-1' },
+ },
+ ],
+ },
+ },
+ },
+ });
+ expect(reminderDetailPath('reminder 1')).toBe('/reminder/reminder%201');
+ expect(new URL(reminderDetailUrl('reminder 1')).pathname).toBe(
+ '/app/reminder/reminder%201'
+ );
+ });
+
+ it('recognizes standalone and Home reminder content', () => {
+ expect(
+ reminderIdFromDetailContent(
+ reminderDetailDestination('standalone').content
+ )
+ ).toBe('standalone');
+ expect(
+ reminderIdFromDetailContent({
+ type: 'component',
+ id: 'home',
+ entryMetadata: {
+ route: {
+ matches: [
+ { id: 'view-home', params: {} },
+ {
+ id: HOME_REMINDER_DETAIL_ROUTE_ID,
+ params: { reminderId: 'inline' },
+ },
+ ],
+ },
+ },
+ })
+ ).toBe('inline');
+ });
+
+ it('prefers current route identity over preserved component params', () => {
+ expect(
+ reminderIdFromDetailContent({
+ type: 'component',
+ id: REMINDER_DETAIL_COMPONENT_ID,
+ params: { reminderId: 'reminder-a' },
+ entryMetadata: {
+ route: {
+ matches: [
+ {
+ id: REMINDER_DETAIL_ROUTE_ID,
+ params: { reminderId: 'reminder-b' },
+ },
+ ],
+ },
+ },
+ })
+ ).toBe('reminder-b');
+ });
+});
+
+describe('openReminderDetail', () => {
+ it.each([false, true])(
+ 'navigates through the manager-owned route (new split: %s)',
+ (openInNewSplit) => {
+ const openWithSplit = vi.fn(() => ({ status: 'navigating' as const }));
+ const handle = { id: 'source' } as SplitHandle;
+ const onApplied = vi.fn();
+ const manager = { openWithSplit } as unknown as SplitManager;
+
+ const result = openReminderDetail('reminder-1', {
+ manager,
+ handle,
+ openInNewSplit,
+ mergeHistory: true,
+ referredFrom: 'home',
+ onApplied,
+ });
+
+ expect(result).toEqual({ status: 'navigating' });
+ expect(openWithSplit).toHaveBeenCalledExactlyOnceWith(
+ reminderDetailDestination('reminder-1').content,
+ {
+ activate: true,
+ preferNewSplit: openInNewSplit,
+ handle,
+ mergeHistory: true,
+ referredFrom: 'home',
+ search: {},
+ onApplied,
+ }
+ );
+ }
+ );
+
+ it('reports unavailable when the app has no split manager', () => {
+ expect(openReminderDetail('reminder-1')).toEqual({
+ status: 'unavailable',
+ });
+ });
+});
diff --git a/apps/web/src/features/reminders/reminder-navigation.ts b/apps/web/src/features/reminders/reminder-navigation.ts
new file mode 100644
index 0000000000..166a6a3ff6
--- /dev/null
+++ b/apps/web/src/features/reminders/reminder-navigation.ts
@@ -0,0 +1,131 @@
+import { globalSplitManager } from '@app/signal/splitLayout';
+import type {
+ OpenSplitResult,
+ ReferredFrom,
+ SplitContent,
+ SplitHandle,
+ SplitManager,
+} from '@components/app/split-layout/layoutManager';
+import { buildSimpleEntityUrl } from '@core/util/url';
+
+export const REMINDER_DETAIL_ROUTE_ID = 'reminder-detail';
+export const HOME_REMINDER_DETAIL_ROUTE_ID = 'home-reminder-detail';
+export const REMINDER_DETAIL_COMPONENT_ID = 'reminder-detail';
+
+function record(value: unknown): Record<string, unknown> | undefined {
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return;
+ return value as Record<string, unknown>;
+}
+
+/** Reminder identity from current standalone or Home route metadata. */
+export function reminderIdFromDetailContent(
+ content: SplitContent
+): string | undefined {
+ if (content.type !== 'component') return;
+
+ const metadata = record(content.entryMetadata);
+ const location = record(metadata?.location) ?? metadata;
+ const route = record(location?.route);
+ const matches = route?.matches;
+ if (Array.isArray(matches)) {
+ for (const match of matches) {
+ const value = record(match);
+ if (
+ value?.id !== REMINDER_DETAIL_ROUTE_ID &&
+ value?.id !== HOME_REMINDER_DETAIL_ROUTE_ID
+ ) {
+ continue;
+ }
+ const reminderId = record(value.params)?.reminderId;
+ if (typeof reminderId === 'string' && reminderId.length > 0) {
+ return reminderId;
+ }
+ }
+ }
+
+ // The router may preserve shell params while replacing this fixed component
+ // from reminder A to B. Route metadata is authoritative when present; params
+ // are only the startup fallback before the route host is available.
+ if (content.id === REMINDER_DETAIL_COMPONENT_ID) {
+ const reminderId = record(content.params)?.reminderId;
+ if (typeof reminderId === 'string' && reminderId.length > 0) {
+ return reminderId;
+ }
+ }
+}
+
+/** Route-backed split content for the standalone reminder detail. */
+export function reminderDetailContent(reminderId: string): SplitContent {
+ return {
+ type: 'component',
+ id: REMINDER_DETAIL_COMPONENT_ID,
+ params: { reminderId },
+ entryMetadata: {
+ route: {
+ matches: [{ id: REMINDER_DETAIL_ROUTE_ID, params: { reminderId } }],
+ },
+ },
+ };
+}
+
+/** A reminder always opens its details first; source navigation lives there. */
+export type ReminderDetailDestination = {
+ kind: 'reminder-detail';
+ reminderId: string;
+ content: SplitContent;
+};
+
+export function reminderDetailDestination(
+ reminderId: string
+): ReminderDetailDestination {
+ return {
+ kind: 'reminder-detail',
+ reminderId,
+ content: reminderDetailContent(reminderId),
+ };
+}
+
+/** The canonical, reload-safe URL copied for a reminder. */
+export function reminderDetailUrl(reminderId: string): string {
+ return buildSimpleEntityUrl({
+ type: 'reminder',
+ id: encodeURIComponent(reminderId),
+ });
+}
+
+/** The app-relative path consumed by Split Router. */
+export function reminderDetailPath(reminderId: string): string {
+ return `/reminder/${encodeURIComponent(reminderId)}`;
+}
+
+/**
+ * Open a reminder through its route-backed lightweight component.
+ *
+ * Split Manager delegates route-owned content to the app navigator, so the
+ * reminder claim controls reuse across standalone and Home locations without a
+ * second router owner.
+ */
+export function openReminderDetail(
+ reminderId: string,
+ options: {
+ manager?: SplitManager;
+ handle?: SplitHandle;
+ openInNewSplit?: boolean;
+ mergeHistory?: boolean;
+ referredFrom?: ReferredFrom;
+ onApplied?: VoidFunction;
+ } = {}
+): OpenSplitResult {
+ const manager = options.manager ?? globalSplitManager();
+ if (!manager) return { status: 'unavailable' };
+
+ return manager.openWithSplit(reminderDetailContent(reminderId), {
+ activate: true,
+ preferNewSplit: options.openInNewSplit,
+ handle: options.handle,
+ mergeHistory: options.mergeHistory,
+ referredFrom: options.referredFrom ?? null,
+ search: {},
+ onApplied: options.onApplied,
+ });
+}
diff --git a/apps/web/src/features/reminders/route.tsx b/apps/web/src/features/reminders/route.tsx
index 4ea8a4f566..82c550dca2 100644
--- a/apps/web/src/features/reminders/route.tsx
+++ b/apps/web/src/features/reminders/route.tsx
@@ -1,20 +1,27 @@
-import { defineRoute } from '@app/lib/split-router';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { defineRoute, useRouteParams } from '@app/lib/split-router';
+import {
+ useSplitDisplayName,
+ useSplitPanelOrThrow,
+} from '@components/app/split-layout/layoutUtils';
import {
RedirectSplit,
usePageViewTracking,
withAuth,
} from '@components/app/split-layout/split-router/app-route-shell';
-import { enableReminders, isFeatureEnabled } from '@core/constant/featureFlags';
-import { lazy } from 'solid-js';
+import { LoadingBlock } from '@core/component/LoadingBlock';
+import { enableReminders } from '@core/constant/featureFlags';
+import { lazy, Show } from 'solid-js';
+import { z } from 'zod';
import { getViewPreset } from '../next-soup/sidebar/soup-filter-presets';
+import { ReminderDetails } from './ReminderEditorSplit';
+import { REMINDER_DETAIL_ROUTE_ID } from './reminder-navigation';
const SoupView = lazy(async () => ({
default: (await import('../next-soup/soup-view/soup-view')).SoupView,
}));
-export const RemindersRouteView = withAuth(() => {
- if (!isFeatureEnabled(enableReminders))
- return <RedirectSplit to={{ type: 'component', id: 'home' }} />;
+function RemindersView() {
usePageViewTracking('reminders');
const preset = getViewPreset('reminders');
return (
@@ -26,6 +33,20 @@ export const RemindersRouteView = withAuth(() => {
disableLocalSearch
/>
);
+}
+
+export const RemindersRouteView = withAuth(() => {
+ const reminders = useFeatureFlag(enableReminders);
+ return (
+ <Show when={!reminders().loading} fallback={<LoadingBlock />}>
+ <Show
+ when={reminders().enabled}
+ fallback={<RedirectSplit to={{ type: 'component', id: 'home' }} />}
+ >
+ <RemindersView />
+ </Show>
+ </Show>
+ );
});
export const remindersRoute = defineRoute({
@@ -35,3 +56,40 @@ export const remindersRoute = defineRoute({
search: '*' as const,
claim: () => ({ namespace: 'component', id: 'reminders' }),
});
+
+function ReminderDetailView() {
+ const params = useRouteParams(reminderDetailRoute);
+ const panel = useSplitPanelOrThrow();
+ usePageViewTracking('reminder');
+ useSplitDisplayName(() => 'Reminder');
+ return (
+ <ReminderDetails
+ reminderId={params.reminderId}
+ onClose={() => panel.handle.close()}
+ />
+ );
+}
+
+const ReminderDetailRouteView = withAuth(() => {
+ const reminders = useFeatureFlag(enableReminders);
+ return (
+ <Show when={!reminders().loading} fallback={<LoadingBlock />}>
+ <Show
+ when={reminders().enabled}
+ fallback={<RedirectSplit to={{ type: 'component', id: 'home' }} />}
+ >
+ <ReminderDetailView />
+ </Show>
+ </Show>
+ );
+});
+
+/** Lightweight standalone reminder detail at `/app/reminder/:reminderId`. */
+export const reminderDetailRoute = defineRoute({
+ id: REMINDER_DETAIL_ROUTE_ID,
+ path: 'reminder/:reminderId',
+ params: z.object({ reminderId: z.string().min(1) }),
+ component: ReminderDetailRouteView,
+ remountKey: ({ reminderId }) => reminderId,
+ claim: ({ reminderId }) => ({ namespace: 'reminder', id: reminderId }),
+});
diff --git a/apps/web/src/features/soup/createSoupEntityActions.ts b/apps/web/src/features/soup/createSoupEntityActions.ts
index 52e8884d54..6c09a36146 100644
--- a/apps/web/src/features/soup/createSoupEntityActions.ts
+++ b/apps/web/src/features/soup/createSoupEntityActions.ts
@@ -253,17 +253,8 @@ export function createSoupEntityActions(): {
if (!entity || entity.type === 'foreign') return undefined;
const splitManager = globalSplitManager();
if (!splitManager) return undefined;
- // A reminder opens its own editor — a `reminder-view` component split —
- // not what it references, so a standalone reminder is openable too and
- // the dedup check is against that editor split, not the reference.
- if (entity.type === 'reminder') {
- const open = splitManager.getSplitByContent(
- 'component',
- `reminder-view~${entity.id}`
- );
- if (open) return undefined;
- return entity;
- }
+ // Reminder route claims perform identity reuse when the action runs.
+ if (entity.type === 'reminder') return entity;
const contentId =
entity.type === 'channel_message' || entity.type === 'channel_thread'
? entity.channelId
diff --git a/apps/web/src/lib/core/hotkey/tokens.ts b/apps/web/src/lib/core/hotkey/tokens.ts
index e4560c885d..32a8ce02d1 100644
--- a/apps/web/src/lib/core/hotkey/tokens.ts
+++ b/apps/web/src/lib/core/hotkey/tokens.ts
@@ -127,6 +127,7 @@ export const TOKENS = {
documents: 'sidebar.goTo.documents',
markdownDocuments: 'sidebar.goTo.markdownDocuments',
tasks: 'sidebar.goTo.tasks',
+ reminders: 'sidebar.goTo.reminders',
channels: 'sidebar.goTo.channels',
calls: 'sidebar.goTo.calls',
companies: 'sidebar.goTo.companies',
diff --git a/apps/web/src/lib/split-router/router.ts b/apps/web/src/lib/split-router/router.ts
index f4e1d3219a..63de7751a8 100644
--- a/apps/web/src/lib/split-router/router.ts
+++ b/apps/web/src/lib/split-router/router.ts
@@ -830,6 +830,7 @@ export function createSplitRouter<TSplitId>(
const targetId =
target === 'new-split' ? undefined : (target as TSplitId);
if (targetId !== undefined && isCurrentDestination(targetId, next)) {
+ navigateOptions.onApplied?.();
return;
}
transitionEntry({
diff --git a/apps/web/src/lib/split-router/tests/router.test.ts b/apps/web/src/lib/split-router/tests/router.test.ts
index f002286409..50f10ba2d9 100644
--- a/apps/web/src/lib/split-router/tests/router.test.ts
+++ b/apps/web/src/lib/split-router/tests/router.test.ts
@@ -206,6 +206,26 @@ describe('split router', () => {
router.dispose();
});
+ it('reports an already-current destination as applied', async () => {
+ const layout = createLayout();
+ const router = createSplitRouter({
+ layout,
+ routes,
+ location: createMemorySplitRouterLocation('/drive'),
+ });
+ await router.settled();
+ const source = layout.snapshot().entries[0].splitId;
+ const open = vi.fn(layout.open);
+ const onApplied = vi.fn();
+
+ router.navigate(source, '/drive', { open, onApplied });
+
+ expect(open).not.toHaveBeenCalled();
+ expect(onApplied).toHaveBeenCalledOnce();
+ expect(layout.snapshot().entries).toHaveLength(1);
+ router.dispose();
+ });
+
it('does not report navigation applied when the host cannot open a pane', async () => {
const layout = createLayout();
const router = createSplitRouter({
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index b9fcb092ce..a758d98e62 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -20,7 +20,7 @@ Switching tabs or navigating an in-app route is not a back/forward-cache restore
| `/app/invite?token=<token>` | GTM invite welcome page ("Welcome, <first name>", Continue → signup). Links come from the staff portal, last 48h, and grant the first month of Premium free once the account is created |
| `/app/internal/invite-links` | Macro staff only (`@macro.com`): create GTM invite links and track opens, signups, and subscriptions |
| `/app/home` | Desktop: Home (notifications + recent activity); mobile: Notifications soup |
-| `/app/home/<block-type>/<uuid>` | Home with an item opened inline; `<block-type>` may be an alias such as `task`; a targeted channel message uses `sN.channels.messageId` (and optionally `sN.channels.threadId`) and a document comment `sN.drive.commentId`; a calendar row renders the Calendar view inline at `/app/home/calendar/<month-or-week-or-day>` with the event, occurrence, and locator range in `sN.calendar.*` |
+| `/app/home/<block-type>/<uuid>` | Home with an item opened inline; `<block-type>` may be an alias such as `task`; a targeted channel message uses `sN.channels.messageId` (and optionally `sN.channels.threadId`) and a document comment `sN.drive.commentId`; a calendar row renders the Calendar view inline at `/app/home/calendar/<month-or-week-or-day>` with the event, occurrence, and locator range in `sN.calendar.*`; reminders use `/app/home/reminder/<uuid>` |
| `/app/mail` | Email client |
| `/app/mail/<uuid>` | Email with a thread opened inline; a targeted message uses `sN.email-detail.messageId` |
| `/app/channels` | Channels list |
@@ -42,6 +42,8 @@ Switching tabs or navigating an in-app route is not a back/forward-cache restore
| `/app/coders/<uuid>` | Code session with the Agents sidebar |
| `/app/agents/chat/<uuid>` | Legacy AI chat opened in the Agents workspace (`/app/agent-chats/<uuid>` remains a compatibility alias) |
| `/app/calls` | Calls list |
+| `/app/reminders` | Reminders list (requires the Reminders flag) |
+| `/app/reminder/<uuid>` | Lightweight reminder details; the same reminder opened from Home or another split reuses its existing route owner |
| `/app/companies` | Customers (CRM; needs a team) |
| `/app/activity` | Activity heatmap + feed |
| `/app/calendar/<month-or-week-or-day>` | Calendar; the focused event, its occurrence, and the locator range use `sN.calendar.*` |
@@ -67,6 +69,14 @@ message/thread target when opening a channel or reusing its existing pane.
Returning to Home's list clears the prior target, so reopening an item without
a specific location does not replay the previous search hit.
+Reminder navigation is native-route only: list, Home, notifications, commands,
+copied links, and new browser tabs use `/app/reminders`,
+`/app/home/reminder/<uuid>`, or `/app/reminder/<uuid>`. Imperative callers use
+`openReminderDetail` so Split Manager sends the typed destination through the
+app content navigator. The standalone and Home routes claim the same reminder
+identity, and callers must never treat a reminder ID as a document ID. Startup
+notification intents are consumed only by the destination's applied callback.
+
When an event opens inline from Home, changing the Calendar period stays under
`/app/home/calendar/`, updates the period segment, and re-focuses that event.
Back/Forward restores the period and its event locator from `sN.calendar.*`.
@@ -229,8 +239,9 @@ The outer sidebar is an icon rail; labels appear in tooltips.
global search. Hold Shift while selecting `Search everything` to open it in a
new split, including when Search is already active. This left-click menu shares
its surface and item styling with the sidebar right-click menus.
-- Nav: `Home`, `Drive`, `Email`, `Chat`, `Tasks`, `Calendar`, `Agents`,
- `Customers`. Calendar and Customers appear only when their features are enabled.
+- Nav: `Home`, `Drive`, `Email`, `Chat`, `Tasks`, `Reminders`, `Calendar`,
+ `Agents`, `Customers`. Reminders, Calendar, and Customers appear only when
+ their features are enabled.
- Bottom: button named after the user (their name, or email when unset) — menu
with `Command menu (Ctrl K)`, `Settings (Ctrl ;)`, `Log out`.