From 226500881776de4f12436ccecc6e8690cc836135 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 30 Nov 2026 23:17:32 +0000 Subject: [PATCH 01/10] feat(app): keep the fullscreen dashboard tile in the URL Store the fullscreen tile in a fullscreenTileId query param so a single tile can be shared by link. Back/forward opens and closes it, and a link to a tile in a collapsed group or inactive tab reveals the tile. Co-authored-by: Mike Shi --- .changeset/shareable-fullscreen-tile.md | 8 +++ packages/app/src/DBDashboardPage.tsx | 85 +++++++++++++++++++++---- 2 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 .changeset/shareable-fullscreen-tile.md diff --git a/.changeset/shareable-fullscreen-tile.md b/.changeset/shareable-fullscreen-tile.md new file mode 100644 index 000000000..20dff5973 --- /dev/null +++ b/.changeset/shareable-fullscreen-tile.md @@ -0,0 +1,8 @@ +--- +'@hyperdx/app': minor +--- + +feat: keep the fullscreen dashboard tile in the `fullscreenTileId` URL param, +so a single tile can be shared by link. Opening the link lands on that tile in +fullscreen, browser back/forward opens and closes it, and the other dashboard +URL params (time range, granularity, where, filters, group state) are kept. diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index 5bb4b4ee9..23a054375 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -512,6 +512,8 @@ const Tile = ({ onTouchEnd, children, isHighlighted, + isFullscreen, + onFullscreenChange, isSelected, onSelect, ref, @@ -555,11 +557,12 @@ const Tile = ({ onTouchEnd?: (e: React.TouchEvent) => void; children?: React.ReactNode; // Resizer tooltip isHighlighted?: boolean; + isFullscreen: boolean; + onFullscreenChange: (isFullscreen: boolean) => void; isSelected?: boolean; onSelect?: (tileId: string) => void; ref?: ForwardedRef; }) => { - const [isFullscreen, setIsFullscreen] = useState(false); const [isFocused, setIsFocused] = useState(false); // A live dashboard's granularity is the coarse refresh interval; heatmaps @@ -601,16 +604,36 @@ const Tile = ({ Granularity | 'auto' | undefined >(() => (granularity as Granularity | undefined) ?? 'auto'); - const openFullscreen = useCallback(() => { - // Reinitialize to the dashboard's current date range and granularity - // each time the fullscreen view is opened. + // The dashboard values the fullscreen view was last seeded from, or null + // while closed. Reseed when the view opens, and when the dashboard's range + // or granularity changes underneath it (back/forward, a shared link whose + // range resolves after mount). A live dashboard moves its range every + // refresh, so there the view keeps the range it opened with. + const [fullscreenSeed, setFullscreenSeed] = useState<{ + dateRange: [Date, Date]; + granularity: SQLInterval | undefined; + } | null>(null); + if (!isFullscreen && fullscreenSeed != null) { + setFullscreenSeed(null); + } else if ( + isFullscreen && + (fullscreenSeed == null || + (!isLive && + (fullscreenSeed.dateRange !== dateRange || + fullscreenSeed.granularity !== granularity))) + ) { + setFullscreenSeed({ dateRange, granularity }); setFullscreenDateRange(dateRange); setFullscreenInputValue(dateRangeToString(dateRange, timeZone)); setFullscreenGranularity( (granularity as Granularity | undefined) ?? 'auto', ); - setIsFullscreen(true); - }, [dateRange, granularity, timeZone, setFullscreenInputValue]); + } + + const openFullscreen = useCallback( + () => onFullscreenChange(true), + [onFullscreenChange], + ); const handleFullscreenSearch = useCallback( (value: string) => { @@ -636,11 +659,7 @@ const Tile = ({ 'f', () => { if (!isFocused) return; - if (isFullscreen) { - setIsFullscreen(false); - } else { - openFullscreen(); - } + onFullscreenChange(!isFullscreen); }, ], ]); @@ -1666,7 +1685,7 @@ const Tile = ({ {/* Fullscreen Modal */} setIsFullscreen(false)} + onClose={() => onFullscreenChange(false)} > {isFullscreen && ( @@ -1976,6 +1995,11 @@ function DBDashboardPage({ const { data: allDashboards } = useDashboards(); const [highlightedTileId] = useQueryState('highlightedTileId'); + // Pushed (not replaced) so back/forward opens and closes the view. + const [fullscreenTileId, setFullscreenTileId] = useQueryState( + 'fullscreenTileId', + parseAsString.withOptions({ history: 'push' }), + ); const [granularity, setGranularity] = useQueryState( 'granularity', @@ -2555,6 +2579,10 @@ function DBDashboardPage({ showAlertAnnotations={showAlertAnnotations} showReleaseAnnotations={showReleaseAnnotations} isHighlighted={highlightedTileId === chart.id} + isFullscreen={fullscreenTileId === chart.id} + onFullscreenChange={isFullscreen => + setFullscreenTileId(isFullscreen ? chart.id : null) + } onUpdateChart={ isKioskMode ? undefined @@ -2647,6 +2675,8 @@ function DBDashboardPage({ granularityOverride, granularity, highlightedTileId, + fullscreenTileId, + setFullscreenTileId, confirm, setDashboard, onTimeRangeSelect, @@ -2741,6 +2771,37 @@ function DBDashboardPage({ ], ); + // The fullscreen view renders inside its tile, so a ?fullscreenTileId link + // must activate the tile's tab and expand its group for the tile to mount. + // A tile ID that matches no tile leaves the dashboard as it is. + useEffect(() => { + if (!fullscreenTileId || !dashboard) return; + const tile = dashboard.tiles.find(t => t.id === fullscreenTileId); + const container = tile?.containerId + ? containers.find(c => c.id === tile.containerId) + : undefined; + if (!tile || !container) return; + const { tabId } = tile; + if (tabId && getActiveTabId(container) !== tabId) { + setUrlActiveTabs(prev => ({ ...(prev ?? {}), [container.id]: tabId })); + } + if (isContainerCollapsed(container)) { + addToUrlSet(setUrlExpandedIds, container.id); + removeFromUrlSet(setUrlCollapsedIds, container.id); + } + }, [ + fullscreenTileId, + dashboard, + containers, + getActiveTabId, + isContainerCollapsed, + setUrlActiveTabs, + addToUrlSet, + removeFromUrlSet, + setUrlCollapsedIds, + setUrlExpandedIds, + ]); + // Collapsible-only subset, used both for bulk collapse/expand and for // disabling the menu items when nothing can be toggled. const collapsibleContainers = useMemo( From 4e3f7beca9554e0ee565a3e3b554813c49deaf73 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 30 Nov 2026 23:17:32 +0000 Subject: [PATCH 02/10] test(app): e2e coverage for the fullscreen tile URL param Co-authored-by: Mike Shi --- .../features/dashboard-fullscreen-url.spec.ts | 333 ++++++++++++++++++ .../tests/e2e/page-objects/DashboardPage.ts | 75 ++++ 2 files changed, 408 insertions(+) create mode 100644 packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts diff --git a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts new file mode 100644 index 000000000..34e7df638 --- /dev/null +++ b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts @@ -0,0 +1,333 @@ +/** + * The fullscreen tile view lives in the `?fullscreenTileId` query param so a + * single tile can be shared by link. These tests guard its interaction with + * the other dashboard URL params (time range, granularity, where, group + * state) and with browser history. + */ +import { Page } from '@playwright/test'; + +import { DashboardPage } from '../page-objects/DashboardPage'; +import { getApiUrl, getSources } from '../utils/api-helpers'; +import { expect, test } from '../utils/base-test'; +import { DEFAULT_LOGS_SOURCE_NAME } from '../utils/constants'; + +const markdownTile = ( + sourceId: string, + id: string, + x: number, + placement: { containerId?: string; tabId?: string } = {}, +) => ({ + id, + x, + y: 0, + w: 12, + h: 4, + ...placement, + config: { + name: id, + source: sourceId, + displayType: 'markdown', + select: [], + where: '', + whereLanguage: 'lucene', + markdown: tileContent(id), + }, +}); + +const tileContent = (id: string) => `Fullscreen content ${id}`; + +const rangeHours = (params: Record) => + (Number(params.to) - Number(params.from)) / (60 * 60 * 1000); + +async function seedDashboard(page: Page): Promise { + const logSources = await getSources(page, 'log'); + const sourceId: string = logSources.find( + (s: { name: string }) => s.name === DEFAULT_LOGS_SOURCE_NAME, + ).id; + const tile = markdownTile.bind(null, sourceId); + const res = await page.request.post(`${getApiUrl()}/dashboards`, { + data: { + name: `E2E fullscreen URL ${Date.now()}`, + containers: [ + { id: 'collapsed-group', title: 'Collapsed group', collapsed: true }, + { + id: 'tabbed-group', + title: 'Tabbed group', + collapsed: false, + tabs: [ + { id: 'tab-one', title: 'Tab one' }, + { id: 'tab-two', title: 'Tab two' }, + ], + }, + ], + tiles: [ + tile('tile-a', 0), + tile('tile-b', 12), + tile('tile-collapsed', 0, { containerId: 'collapsed-group' }), + tile('tile-tab-one', 0, { + containerId: 'tabbed-group', + tabId: 'tab-one', + }), + tile('tile-tab-two', 0, { + containerId: 'tabbed-group', + tabId: 'tab-two', + }), + ], + tags: [], + }, + }); + expect(res.ok()).toBeTruthy(); + const body = await res.json(); + return body.id ?? body._id; +} + +test.describe( + 'Dashboard fullscreen tile URL state', + { tag: ['@dashboard', '@full-stack'] }, + () => { + let dashboardPage: DashboardPage; + let dashboardId: string; + + // Fixed past range so the values can be compared exactly. + const to = Date.UTC(2026, 0, 15, 12, 0, 0); + const from = to - 2 * 60 * 60 * 1000; + const baseParams = { + from: String(from), + to: String(to), + granularity: '5 minute', + }; + + test.beforeEach(async ({ page }) => { + test.setTimeout(60000); + dashboardPage = new DashboardPage(page); + dashboardId = await seedDashboard(page); + }); + + async function expectFullscreenShowing(tileId: string) { + await expect(dashboardPage.fullscreenModalBody).toContainText( + tileContent(tileId), + ); + await expect + .poll(() => dashboardPage.getFullscreenTileIdParam()) + .toBe(tileId); + } + + async function expectFullscreenClosed() { + await expect(dashboardPage.fullscreenModalBody).toHaveCount(0); + await expect + .poll(() => dashboardPage.getFullscreenTileIdParam()) + .toBeNull(); + } + + test('a link with the param opens that tile fullscreen with the URL time range and granularity', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, { + ...baseParams, + fullscreenTileId: 'tile-b', + }); + + await test.step('The linked tile opens fullscreen', async () => { + await expectFullscreenShowing('tile-b'); + await expect(dashboardPage.fullscreenModalBody).not.toContainText( + tileContent('tile-a'), + ); + }); + + await test.step('The fullscreen pickers start from the URL values', async () => { + await expect(dashboardPage.fullscreenTimePickerInput).toHaveValue( + await dashboardPage.dashboardTimePickerInput.inputValue(), + ); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '5 Minutes Granularity', + ); + }); + + await test.step('Closing removes only the fullscreen param', async () => { + await dashboardPage.closeFullscreen(); + await expectFullscreenClosed(); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + + await test.step('The fullscreen view survives a reload', async () => { + await dashboardPage.goBack(); + await expectFullscreenShowing('tile-b'); + await dashboardPage.reload(); + await expectFullscreenShowing('tile-b'); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + }); + + test('entering and exiting fullscreen keeps time range, granularity, and where params', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + + await dashboardPage.setGlobalFilter('ServiceName:fullscreen-test'); + await expect + .poll(() => dashboardPage.getUrlParamsExceptFullscreen().where) + .toBeTruthy(); + const paramsBefore = dashboardPage.getUrlParamsExceptFullscreen(); + expect(paramsBefore).toMatchObject(baseParams); + + await test.step('Open with the toolbar button', async () => { + await dashboardPage.openFullscreenForTileId('tile-a'); + await expectFullscreenShowing('tile-a'); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + paramsBefore, + ); + }); + + await test.step('Fullscreen picker changes keep the tile open and leave dashboard params alone', async () => { + await dashboardPage.selectFullscreenRelativeTime('Last 15 minutes'); + await dashboardPage.changeFullscreenGranularity('1 Minute Granularity'); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '1 Minute Granularity', + ); + await expectFullscreenShowing('tile-a'); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + paramsBefore, + ); + }); + + await test.step('Close with Escape', async () => { + await dashboardPage.closeFullscreen(); + await expectFullscreenClosed(); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + paramsBefore, + ); + }); + + await test.step('The f shortcut toggles the param', async () => { + await dashboardPage.pressFullscreenHotkeyOnTile('tile-b'); + await expectFullscreenShowing('tile-b'); + await dashboardPage.pressFullscreenHotkey(); + await expectFullscreenClosed(); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + paramsBefore, + ); + }); + }); + + test('rapid time range and fullscreen changes end in the combined URL state', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + + await test.step('Change the time range, then open fullscreen right away', async () => { + await dashboardPage.timePicker.selectRelativeTime('Last 6 hours'); + await dashboardPage.openFullscreenForTileId('tile-a'); + await expectFullscreenShowing('tile-a'); + await expect + .poll(() => dashboardPage.getUrlParamsExceptFullscreen().from) + .not.toBe(baseParams.from); + const params = dashboardPage.getUrlParamsExceptFullscreen(); + expect(rangeHours(params)).toBeCloseTo(6, 2); + expect(params.granularity).toBe(baseParams.granularity); + }); + + await test.step('Close fullscreen, then change the time range right away', async () => { + await dashboardPage.closeFullscreen(); + await dashboardPage.timePicker.selectRelativeTime('Last 1 hour'); + await expectFullscreenClosed(); + await expect + .poll(() => + Math.round( + rangeHours(dashboardPage.getUrlParamsExceptFullscreen()), + ), + ) + .toBe(1); + expect(dashboardPage.getUrlParamsExceptFullscreen().granularity).toBe( + baseParams.granularity, + ); + }); + }); + + test('back and forward toggle the fullscreen view', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + + await dashboardPage.openFullscreenForTileId('tile-a'); + await expectFullscreenShowing('tile-a'); + await dashboardPage.closeFullscreen(); + await expectFullscreenClosed(); + + await test.step('Back reopens the tile', async () => { + await dashboardPage.goBack(); + await expectFullscreenShowing('tile-a'); + }); + + await test.step('Back again returns to the dashboard', async () => { + await dashboardPage.goBack(); + await expectFullscreenClosed(); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + }); + + await test.step('Forward reopens the tile', async () => { + await dashboardPage.goForward(); + await expectFullscreenShowing('tile-a'); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + + await test.step('Forward again closes it', async () => { + await dashboardPage.goForward(); + await expectFullscreenClosed(); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + }); + + test('an unknown tile ID shows the normal dashboard', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, { + ...baseParams, + fullscreenTileId: 'no-such-tile', + }); + + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + await expect(dashboardPage.fullscreenModalBody).toHaveCount(0); + + await test.step('Opening a real tile replaces the unknown ID', async () => { + await dashboardPage.openFullscreenForTileId('tile-a'); + await expectFullscreenShowing('tile-a'); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + }); + + test('a link to a tile in a collapsed group or inactive tab reveals it', async () => { + await test.step('Collapsed group', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, { + ...baseParams, + fullscreenTileId: 'tile-collapsed', + }); + await expectFullscreenShowing('tile-collapsed'); + await expect + .poll(() => dashboardPage.getExpandedParam()) + .toContain('collapsed-group'); + await dashboardPage.closeFullscreen(); + await expect(dashboardPage.getTileById('tile-collapsed')).toBeVisible(); + }); + + await test.step('Inactive tab', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, { + ...baseParams, + fullscreenTileId: 'tile-tab-two', + }); + await expectFullscreenShowing('tile-tab-two'); + await expect + .poll(() => dashboardPage.getActiveTabsParam()['tabbed-group']) + .toBe('tab-two'); + await dashboardPage.closeFullscreen(); + await expect(dashboardPage.getTileById('tile-tab-two')).toBeVisible(); + await expect(dashboardPage.getTileById('tile-tab-one')).toHaveCount(0); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + }); + }, +); diff --git a/packages/app/tests/e2e/page-objects/DashboardPage.ts b/packages/app/tests/e2e/page-objects/DashboardPage.ts index 54a87a038..337cc3f86 100644 --- a/packages/app/tests/e2e/page-objects/DashboardPage.ts +++ b/packages/app/tests/e2e/page-objects/DashboardPage.ts @@ -2539,4 +2539,79 @@ export class DashboardPage { timeout: 5000, }); } + + get fullscreenGranularityPicker() { + return this.fullscreenModalBody.getByTestId('granularity-picker'); + } + + async changeFullscreenGranularity(granularity: string) { + await this.fullscreenGranularityPicker.click(); + // The dashboard's own granularity dropdown keeps its options mounted. + await this.page + .locator('[role="option"]', { hasText: granularity }) + .filter({ visible: true }) + .click(); + } + + /** Open the dashboard with the given query params already in the URL. */ + async gotoDashboardWithParams( + dashboardId: string, + params: Record, + ) { + const query = new URLSearchParams(params).toString(); + await this.page.goto(`/dashboards/${dashboardId}?${query}`); + } + + getTileById(tileId: string): Locator { + return this.page.getByTestId(`dashboard-tile-${tileId}`); + } + + /** Click the toolbar fullscreen button of the tile with this id. */ + async openFullscreenForTileId(tileId: string) { + const tile = this.getTileById(tileId); + await tile.scrollIntoViewIfNeeded(); + await tile.hover(); + await this.page.getByTestId(`tile-fullscreen-button-${tileId}`).click(); + await this.fullscreenTimePickerInput.waitFor({ + state: 'visible', + timeout: 10000, + }); + } + + /** + * The dashboard's own time picker input. The fullscreen modal portals its + * picker after the page content, so the first match is the dashboard's. + */ + get dashboardTimePickerInput() { + return this.page.getByTestId('time-picker-input').first(); + } + + /** Press the `f` shortcut while hovering the tile with this id. */ + async pressFullscreenHotkeyOnTile(tileId: string) { + await this.getTileById(tileId).hover(); + await this.pressFullscreenHotkey(); + } + + async pressFullscreenHotkey() { + await this.page.keyboard.press('f'); + } + + async goBack() { + await this.page.goBack(); + } + + async goForward() { + await this.page.goForward(); + } + + getFullscreenTileIdParam(): string | null { + return new URL(this.page.url()).searchParams.get('fullscreenTileId'); + } + + /** All query params except `fullscreenTileId`, for comparing URL state. */ + getUrlParamsExceptFullscreen(): Record { + const params = new URL(this.page.url()).searchParams; + params.delete('fullscreenTileId'); + return Object.fromEntries(params.entries()); + } } From b8cd7b5cb077315bed49089f2f89ccdf489d7e31 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 30 Nov 2026 23:28:06 +0000 Subject: [PATCH 03/10] fix(app): keep fullscreen picker state while a live dashboard's tab is hidden Co-authored-by: Mike Shi --- packages/app/src/DBDashboardPage.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index 23a054375..a7d7e3bad 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -501,6 +501,7 @@ const Tile = ({ showAlertAnnotations, showReleaseAnnotations, isLive, + isLiveMode, readOnly, onFilter, @@ -545,6 +546,11 @@ const Tile = ({ // When true, draw release markers on this tile's chart. showReleaseAnnotations?: boolean; isLive?: boolean; + /** + * The dashboard is in live mode. Unlike `isLive`, stays true while the + * browser tab is hidden and refreshes pause. + */ + isLiveMode?: boolean; readOnly?: boolean; /** Set when an ad hoc filter broadcasts to this tile; clicked values update it. */ onFilter?: TileFilterHandler; @@ -618,7 +624,7 @@ const Tile = ({ } else if ( isFullscreen && (fullscreenSeed == null || - (!isLive && + (!isLiveMode && (fullscreenSeed.dateRange !== dateRange || fullscreenSeed.granularity !== granularity))) ) { @@ -2568,6 +2574,7 @@ function DBDashboardPage({ onEditClick={() => setEditedTile(chart)} readOnly={isKioskMode} isLive={isRefreshEnabled} + isLiveMode={isLive || isKioskMode} granularity={ isRefreshEnabled ? granularityOverride : (granularity ?? undefined) } @@ -2672,6 +2679,7 @@ function DBDashboardPage({ dashboard, searchedTimeRange, isRefreshEnabled, + isLive, granularityOverride, granularity, highlightedTileId, From f68ae7828a1e813a6084293c284fc9a0ce50fe68 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 30 Nov 2026 23:39:55 +0000 Subject: [PATCH 04/10] test(app): cover fullscreen picker state on a live dashboard with a hidden tab Co-authored-by: Mike Shi --- .../features/dashboard-fullscreen-url.spec.ts | 31 +++++++++++++++++++ .../tests/e2e/page-objects/DashboardPage.ts | 18 +++++++++++ 2 files changed, 49 insertions(+) diff --git a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts index 34e7df638..280446d88 100644 --- a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts +++ b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts @@ -280,6 +280,37 @@ test.describe( }); }); + test('a live dashboard keeps the fullscreen picker values while the tab is hidden', async () => { + // Without a URL granularity, hiding the tab swaps the tiles from the + // live auto granularity back to none. + await dashboardPage.gotoDashboardWithParams(dashboardId, { + from: baseParams.from, + to: baseParams.to, + }); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + await dashboardPage.toggleLiveMode(); + + await dashboardPage.openFullscreenForTileId('tile-a'); + await dashboardPage.selectFullscreenRelativeTime('Last 15 minutes'); + await dashboardPage.changeFullscreenGranularity('1 Minute Granularity'); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '1 Minute Granularity', + ); + const fullscreenRange = + await dashboardPage.fullscreenTimePickerInput.inputValue(); + + await dashboardPage.setTabHidden(true); + await dashboardPage.setTabHidden(false); + + await expectFullscreenShowing('tile-a'); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '1 Minute Granularity', + ); + await expect(dashboardPage.fullscreenTimePickerInput).toHaveValue( + fullscreenRange, + ); + }); + test('an unknown tile ID shows the normal dashboard', async () => { await dashboardPage.gotoDashboardWithParams(dashboardId, { ...baseParams, diff --git a/packages/app/tests/e2e/page-objects/DashboardPage.ts b/packages/app/tests/e2e/page-objects/DashboardPage.ts index 337cc3f86..02fbbc9d4 100644 --- a/packages/app/tests/e2e/page-objects/DashboardPage.ts +++ b/packages/app/tests/e2e/page-objects/DashboardPage.ts @@ -2596,6 +2596,24 @@ export class DashboardPage { await this.page.keyboard.press('f'); } + /** + * Fire `visibilitychange` as if the browser tab were hidden or shown again. + * Headless Chromium keeps every page visible, so override the property. + */ + async setTabHidden(hidden: boolean) { + await this.page.evaluate(isHidden => { + Object.defineProperty(document, 'visibilityState', { + configurable: true, + get: () => (isHidden ? 'hidden' : 'visible'), + }); + Object.defineProperty(document, 'hidden', { + configurable: true, + get: () => isHidden, + }); + document.dispatchEvent(new Event('visibilitychange')); + }, hidden); + } + async goBack() { await this.page.goBack(); } From 982de2af1d0467a228ef1fa353cc3cc3918cd419 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 13:37:21 +0000 Subject: [PATCH 05/10] feat(app): share the fullscreen tile's own range and granularity in the URL The fullscreen view's pickers now write fullscreenFrom, fullscreenTo and fullscreenGranularity instead of local state. They stay separate from the dashboard's from/to and granularity, so changing them refetches only the fullscreen tile. Co-authored-by: Mike Shi --- .changeset/shareable-fullscreen-tile.md | 10 +- packages/app/src/DBDashboardPage.tsx | 144 +++++++++++++++++++----- 2 files changed, 122 insertions(+), 32 deletions(-) diff --git a/.changeset/shareable-fullscreen-tile.md b/.changeset/shareable-fullscreen-tile.md index 20dff5973..778eb57d3 100644 --- a/.changeset/shareable-fullscreen-tile.md +++ b/.changeset/shareable-fullscreen-tile.md @@ -2,7 +2,9 @@ '@hyperdx/app': minor --- -feat: keep the fullscreen dashboard tile in the `fullscreenTileId` URL param, -so a single tile can be shared by link. Opening the link lands on that tile in -fullscreen, browser back/forward opens and closes it, and the other dashboard -URL params (time range, granularity, where, filters, group state) are kept. +feat: keep the fullscreen dashboard tile in the URL, so a single tile can be +shared by link. `fullscreenTileId` holds the tile, and `fullscreenFrom`, +`fullscreenTo` and `fullscreenGranularity` hold the range and granularity +picked inside the fullscreen view, separate from the dashboard's own. Opening +the link lands on that tile in fullscreen, browser back/forward steps through +the view, and the other dashboard URL params are kept. diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index a7d7e3bad..bf68faaef 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -16,8 +16,11 @@ import { pick } from 'lodash'; import { parseAsArrayOf, parseAsBoolean, + parseAsFloat, parseAsString, + parseAsStringEnum, useQueryState, + useQueryStates, } from 'nuqs'; import { ErrorBoundary } from 'react-error-boundary'; import RGL from 'react-grid-layout'; @@ -29,6 +32,7 @@ import { import { convertToDashboardTemplate, Granularity, + isDateRangeEqual, isTimeSeriesDisplayType, savedChartConfigSupportsAlerts, } from '@hyperdx/common-utils/dist/core/utils'; @@ -483,6 +487,11 @@ const TilePlaceholder = ({ ); +type FullscreenTileView = { + dateRange?: [Date, Date]; + granularity?: Granularity | 'auto'; +}; + const Tile = ({ chart, dateRange, @@ -515,6 +524,8 @@ const Tile = ({ isHighlighted, isFullscreen, onFullscreenChange, + fullscreenView, + onFullscreenViewChange, isSelected, onSelect, ref, @@ -565,6 +576,9 @@ const Tile = ({ isHighlighted?: boolean; isFullscreen: boolean; onFullscreenChange: (isFullscreen: boolean) => void; + /** The fullscreen view's own picker values, where they differ from the dashboard's. */ + fullscreenView?: FullscreenTileView; + onFullscreenViewChange: (view: FullscreenTileView) => void; isSelected?: boolean; onSelect?: (tileId: string) => void; ref?: ForwardedRef; @@ -600,21 +614,13 @@ const Tile = ({ const timeZone = useDisplayTimeZone(); - // Date range and granularity state local to the fullscreen view so that - // changing them does not propagate up to the dashboard. - const [fullscreenDateRange, setFullscreenDateRange] = - useState<[Date, Date]>(dateRange); - const [fullscreenInputValue, setFullscreenInputValue] = - useTimeRangeInputText(fullscreenDateRange); - const [fullscreenGranularity, setFullscreenGranularity] = useState< - Granularity | 'auto' | undefined - >(() => (granularity as Granularity | undefined) ?? 'auto'); - - // The dashboard values the fullscreen view was last seeded from, or null - // while closed. Reseed when the view opens, and when the dashboard's range - // or granularity changes underneath it (back/forward, a shared link whose - // range resolves after mount). A live dashboard moves its range every - // refresh, so there the view keeps the range it opened with. + // The fullscreen view starts from the dashboard's range and granularity. + // Its own picker changes go to `fullscreenView` (URL params read only by + // this view), so they never refetch the dashboard. `fullscreenSeed` holds + // the dashboard values the view starts from, or null while closed. It + // follows the dashboard when those values change underneath (back/forward, + // a shared link whose range resolves after mount), except on a live + // dashboard, whose range moves every refresh. const [fullscreenSeed, setFullscreenSeed] = useState<{ dateRange: [Date, Date]; granularity: SQLInterval | undefined; @@ -629,11 +635,33 @@ const Tile = ({ fullscreenSeed.granularity !== granularity))) ) { setFullscreenSeed({ dateRange, granularity }); - setFullscreenDateRange(dateRange); - setFullscreenInputValue(dateRangeToString(dateRange, timeZone)); - setFullscreenGranularity( - (granularity as Granularity | undefined) ?? 'auto', - ); + } + const fullscreenDateRange = + fullscreenView?.dateRange ?? fullscreenSeed?.dateRange ?? dateRange; + const fullscreenGranularity: Granularity | 'auto' = + fullscreenView?.granularity ?? + ((fullscreenSeed?.granularity ?? granularity) as Granularity | undefined) ?? + 'auto'; + + // Rewrite the picker text when the range changes from outside it (open, + // back/forward, chart brush), but keep what the user typed or picked + // ("Last 15 minutes") for the range their own search produced. + const [fullscreenInputValue, setFullscreenInputValue] = + useTimeRangeInputText(fullscreenDateRange); + const [fullscreenInputRange, setFullscreenInputRange] = + useState(fullscreenDateRange); + const [fullscreenSearchedRange, setFullscreenSearchedRange] = useState< + [Date, Date] | null + >(null); + if (!isDateRangeEqual(fullscreenInputRange, fullscreenDateRange)) { + setFullscreenInputRange(fullscreenDateRange); + setFullscreenSearchedRange(null); + if ( + fullscreenSearchedRange == null || + !isDateRangeEqual(fullscreenSearchedRange, fullscreenDateRange) + ) { + setFullscreenInputValue(dateRangeToString(fullscreenDateRange, timeZone)); + } } const openFullscreen = useCallback( @@ -645,10 +673,11 @@ const Tile = ({ (value: string) => { const [start, end] = parseTimeRangeInput(value, timeZone); if (start != null && end != null) { - setFullscreenDateRange([start, end]); + setFullscreenSearchedRange([start, end]); + onFullscreenViewChange({ dateRange: [start, end] }); } }, - [timeZone], + [timeZone, onFullscreenViewChange], ); useEffect(() => { @@ -1386,7 +1415,10 @@ const Tile = ({ readOnly ? undefined : isFullscreenView - ? (start, end) => setFullscreenDateRange([start, end]) + ? (start, end) => + onFullscreenViewChange({ + dateRange: [start, end], + }) : onTimeRangeSelect } setDisplayType={ @@ -1597,6 +1629,7 @@ const Tile = ({ dateRange, fullscreenDateRange, fullscreenGranularity, + onFullscreenViewChange, filterWarning, isSourceMissing, isSourceUnset, @@ -1703,7 +1736,9 @@ const Tile = ({ /> + onFullscreenViewChange({ granularity: value ?? 'auto' }) + } /> @@ -2001,10 +2036,57 @@ function DBDashboardPage({ const { data: allDashboards } = useDashboards(); const [highlightedTileId] = useQueryState('highlightedTileId'); - // Pushed (not replaced) so back/forward opens and closes the view. - const [fullscreenTileId, setFullscreenTileId] = useQueryState( - 'fullscreenTileId', - parseAsString.withOptions({ history: 'push' }), + // The fullscreen tile and the range and granularity picked inside its view, + // so a link reopens exactly that view. Kept apart from `from`/`to` and + // `granularity` so fullscreen changes don't refetch every dashboard tile. + // Pushed (not replaced) so back/forward steps through them. + const [fullscreenState, setFullscreenState] = useQueryStates( + { + fullscreenTileId: parseAsString, + fullscreenFrom: parseAsFloat, + fullscreenTo: parseAsFloat, + fullscreenGranularity: parseAsStringEnum([ + ...Object.values(Granularity), + 'auto', + ]), + }, + { history: 'push' }, + ); + const { fullscreenTileId, fullscreenFrom, fullscreenTo } = fullscreenState; + const fullscreenView = useMemo((): FullscreenTileView => { + const hasRange = + fullscreenFrom != null && + fullscreenTo != null && + Number.isFinite(fullscreenFrom) && + Number.isFinite(fullscreenTo) && + fullscreenFrom < fullscreenTo; + return { + dateRange: hasRange + ? [new Date(fullscreenFrom), new Date(fullscreenTo)] + : undefined, + granularity: fullscreenState.fullscreenGranularity ?? undefined, + }; + }, [fullscreenFrom, fullscreenTo, fullscreenState.fullscreenGranularity]); + const setFullscreenTileId = useCallback( + (tileId: string | null) => + setFullscreenState({ + fullscreenTileId: tileId, + fullscreenFrom: null, + fullscreenTo: null, + fullscreenGranularity: null, + }), + [setFullscreenState], + ); + const setFullscreenView = useCallback( + ({ dateRange, granularity }: FullscreenTileView) => + setFullscreenState({ + ...(dateRange && { + fullscreenFrom: dateRange[0].getTime(), + fullscreenTo: dateRange[1].getTime(), + }), + ...(granularity && { fullscreenGranularity: granularity }), + }), + [setFullscreenState], ); const [granularity, setGranularity] = useQueryState( @@ -2590,6 +2672,10 @@ function DBDashboardPage({ onFullscreenChange={isFullscreen => setFullscreenTileId(isFullscreen ? chart.id : null) } + fullscreenView={ + fullscreenTileId === chart.id ? fullscreenView : undefined + } + onFullscreenViewChange={setFullscreenView} onUpdateChart={ isKioskMode ? undefined @@ -2685,6 +2771,8 @@ function DBDashboardPage({ highlightedTileId, fullscreenTileId, setFullscreenTileId, + fullscreenView, + setFullscreenView, confirm, setDashboard, onTimeRangeSelect, From da0203c7738a0a701f1c6cbe08c7d7057fcdff6b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 13:37:21 +0000 Subject: [PATCH 06/10] test(app): e2e coverage for the fullscreen range and granularity params Co-authored-by: Mike Shi --- .../features/dashboard-fullscreen-url.spec.ts | 67 +++++++++++++++++++ .../tests/e2e/page-objects/DashboardPage.ts | 21 +++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts index 280446d88..ec60e0534 100644 --- a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts +++ b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts @@ -117,6 +117,11 @@ test.describe( await expect .poll(() => dashboardPage.getFullscreenTileIdParam()) .toBeNull(); + expect(dashboardPage.getFullscreenViewParams()).toEqual({ + from: null, + to: null, + granularity: null, + }); } test('a link with the param opens that tile fullscreen with the URL time range and granularity', async () => { @@ -210,6 +215,68 @@ test.describe( }); }); + test('the range and granularity picked in fullscreen are shared by the link', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + await dashboardPage.openFullscreenForTileId('tile-a'); + const dashboardRangeText = + await dashboardPage.fullscreenTimePickerInput.inputValue(); + + await test.step('Picker changes go to the fullscreen params only', async () => { + await dashboardPage.selectFullscreenRelativeTime('Last 15 minutes'); + await expect + .poll(() => dashboardPage.getFullscreenViewParams().from) + .not.toBeNull(); + await dashboardPage.changeFullscreenGranularity('1 Minute Granularity'); + await expect + .poll(() => dashboardPage.getFullscreenViewParams().granularity) + .toBe('1 minute'); + const { from: fsFrom, to: fsTo } = + dashboardPage.getFullscreenViewParams(); + expect(rangeHours({ from: fsFrom ?? '', to: fsTo ?? '' })).toBeCloseTo( + 0.25, + 2, + ); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + + const fullscreenParams = dashboardPage.getFullscreenViewParams(); + + await test.step('Opening the link restores the fullscreen pickers', async () => { + await dashboardPage.reload(); + await expectFullscreenShowing('tile-a'); + expect(dashboardPage.getFullscreenViewParams()).toEqual( + fullscreenParams, + ); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '1 Minute Granularity', + ); + await expect(dashboardPage.fullscreenTimePickerInput).not.toHaveValue( + dashboardRangeText, + ); + expect(dashboardPage.getUrlParamsExceptFullscreen()).toMatchObject( + baseParams, + ); + }); + + await test.step('Back steps through the picker changes, then closes', async () => { + await dashboardPage.goBack(); + await expectFullscreenShowing('tile-a'); + await expect(dashboardPage.fullscreenGranularityPicker).toHaveValue( + '5 Minutes Granularity', + ); + await dashboardPage.goBack(); + await expectFullscreenShowing('tile-a'); + await expect(dashboardPage.fullscreenTimePickerInput).toHaveValue( + dashboardRangeText, + ); + await dashboardPage.goBack(); + await expectFullscreenClosed(); + }); + }); + test('rapid time range and fullscreen changes end in the combined URL state', async () => { await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); diff --git a/packages/app/tests/e2e/page-objects/DashboardPage.ts b/packages/app/tests/e2e/page-objects/DashboardPage.ts index 02fbbc9d4..7ff0a7ea8 100644 --- a/packages/app/tests/e2e/page-objects/DashboardPage.ts +++ b/packages/app/tests/e2e/page-objects/DashboardPage.ts @@ -2626,10 +2626,27 @@ export class DashboardPage { return new URL(this.page.url()).searchParams.get('fullscreenTileId'); } - /** All query params except `fullscreenTileId`, for comparing URL state. */ + /** The range and granularity picked inside the fullscreen view. */ + getFullscreenViewParams() { + const params = new URL(this.page.url()).searchParams; + return { + from: params.get('fullscreenFrom'), + to: params.get('fullscreenTo'), + granularity: params.get('fullscreenGranularity'), + }; + } + + /** All query params except the fullscreen ones, for comparing URL state. */ getUrlParamsExceptFullscreen(): Record { const params = new URL(this.page.url()).searchParams; - params.delete('fullscreenTileId'); + for (const key of [ + 'fullscreenTileId', + 'fullscreenFrom', + 'fullscreenTo', + 'fullscreenGranularity', + ]) { + params.delete(key); + } return Object.fromEntries(params.entries()); } } From 0235ebc126d88e4ffa0f1bbe62ebdd9ef79b7611 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 13:46:42 +0000 Subject: [PATCH 07/10] fix(app): reset unapplied fullscreen picker text when the view reopens Co-authored-by: Mike Shi --- packages/app/src/DBDashboardPage.tsx | 22 ++++++++++++------- .../features/dashboard-fullscreen-url.spec.ts | 17 ++++++++++++++ .../tests/e2e/page-objects/DashboardPage.ts | 18 +++++++++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index bf68faaef..125d50736 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -625,14 +625,16 @@ const Tile = ({ dateRange: [Date, Date]; granularity: SQLInterval | undefined; } | null>(null); + const isOpeningFullscreen = isFullscreen && fullscreenSeed == null; if (!isFullscreen && fullscreenSeed != null) { setFullscreenSeed(null); } else if ( - isFullscreen && - (fullscreenSeed == null || - (!isLiveMode && - (fullscreenSeed.dateRange !== dateRange || - fullscreenSeed.granularity !== granularity))) + isOpeningFullscreen || + (isFullscreen && + fullscreenSeed != null && + !isLiveMode && + (fullscreenSeed.dateRange !== dateRange || + fullscreenSeed.granularity !== granularity)) ) { setFullscreenSeed({ dateRange, granularity }); } @@ -643,8 +645,8 @@ const Tile = ({ ((fullscreenSeed?.granularity ?? granularity) as Granularity | undefined) ?? 'auto'; - // Rewrite the picker text when the range changes from outside it (open, - // back/forward, chart brush), but keep what the user typed or picked + // Rewrite the picker text on open and when the range changes from outside + // it (back/forward, chart brush), but keep what the user typed or picked // ("Last 15 minutes") for the range their own search produced. const [fullscreenInputValue, setFullscreenInputValue] = useTimeRangeInputText(fullscreenDateRange); @@ -653,10 +655,14 @@ const Tile = ({ const [fullscreenSearchedRange, setFullscreenSearchedRange] = useState< [Date, Date] | null >(null); - if (!isDateRangeEqual(fullscreenInputRange, fullscreenDateRange)) { + if ( + isOpeningFullscreen || + !isDateRangeEqual(fullscreenInputRange, fullscreenDateRange) + ) { setFullscreenInputRange(fullscreenDateRange); setFullscreenSearchedRange(null); if ( + isOpeningFullscreen || fullscreenSearchedRange == null || !isDateRangeEqual(fullscreenSearchedRange, fullscreenDateRange) ) { diff --git a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts index ec60e0534..a51d6ccc2 100644 --- a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts +++ b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts @@ -277,6 +277,23 @@ test.describe( }); }); + test('reopening fullscreen drops picker text that was typed but not applied', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); + await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); + await dashboardPage.openFullscreenForTileId('tile-a'); + const dashboardRangeText = + await dashboardPage.fullscreenTimePickerInput.inputValue(); + + await dashboardPage.typeFullscreenTimeRange('Last 3 days'); + await dashboardPage.closeFullscreenFromPicker(); + await expectFullscreenClosed(); + + await dashboardPage.openFullscreenForTileId('tile-a'); + await expect(dashboardPage.fullscreenTimePickerInput).toHaveValue( + dashboardRangeText, + ); + }); + test('rapid time range and fullscreen changes end in the combined URL state', async () => { await dashboardPage.gotoDashboardWithParams(dashboardId, baseParams); await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); diff --git a/packages/app/tests/e2e/page-objects/DashboardPage.ts b/packages/app/tests/e2e/page-objects/DashboardPage.ts index 7ff0a7ea8..e7cec8678 100644 --- a/packages/app/tests/e2e/page-objects/DashboardPage.ts +++ b/packages/app/tests/e2e/page-objects/DashboardPage.ts @@ -2540,6 +2540,24 @@ export class DashboardPage { }); } + /** Type into the fullscreen time picker without applying the range. */ + async typeFullscreenTimeRange(text: string) { + await this.fullscreenTimePickerInput.fill(text); + } + + /** + * Close fullscreen with Escape even when a picker popover is open, since + * the first Escape then only closes the popover. + */ + async closeFullscreenFromPicker() { + await expect(async () => { + await this.page.keyboard.press('Escape'); + await expect(this.fullscreenTimePickerInput).toBeHidden({ + timeout: 1000, + }); + }).toPass({ timeout: 10000 }); + } + get fullscreenGranularityPicker() { return this.fullscreenModalBody.getByTestId('granularity-picker'); } From 7fcec1c09e160ed2c07dd31d6124817d1bf0b4e1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 13:56:23 +0000 Subject: [PATCH 08/10] fix(app): skip the fullscreen tab reveal for a tile whose tab no longer exists Co-authored-by: Mike Shi --- packages/app/src/DBDashboardPage.tsx | 4 +++- .../e2e/features/dashboard-fullscreen-url.spec.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index 125d50736..f6814babf 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -2884,7 +2884,9 @@ function DBDashboardPage({ : undefined; if (!tile || !container) return; const { tabId } = tile; - if (tabId && getActiveTabId(container) !== tabId) { + // A stale tabId never becomes active, so setting it would loop. + const isKnownTab = container.tabs?.some(t => t.id === tabId) ?? false; + if (tabId && isKnownTab && getActiveTabId(container) !== tabId) { setUrlActiveTabs(prev => ({ ...(prev ?? {}), [container.id]: tabId })); } if (isContainerCollapsed(container)) { diff --git a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts index a51d6ccc2..3b2420ced 100644 --- a/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts +++ b/packages/app/tests/e2e/features/dashboard-fullscreen-url.spec.ts @@ -72,6 +72,10 @@ async function seedDashboard(page: Page): Promise { containerId: 'tabbed-group', tabId: 'tab-two', }), + tile('tile-stale-tab', 12, { + containerId: 'tabbed-group', + tabId: 'deleted-tab', + }), ], tags: [], }, @@ -404,6 +408,16 @@ test.describe( await expect(dashboardPage.getTileById('tile-a')).toBeVisible(); await expect(dashboardPage.fullscreenModalBody).toHaveCount(0); + await test.step('A tile whose tab no longer exists leaves the tabs alone', async () => { + await dashboardPage.gotoDashboardWithParams(dashboardId, { + ...baseParams, + fullscreenTileId: 'tile-stale-tab', + }); + await expect(dashboardPage.getTileById('tile-tab-one')).toBeVisible(); + await expect(dashboardPage.fullscreenModalBody).toHaveCount(0); + expect(dashboardPage.getActiveTabsParam()).toEqual({}); + }); + await test.step('Opening a real tile replaces the unknown ID', async () => { await dashboardPage.openFullscreenForTileId('tile-a'); await expectFullscreenShowing('tile-a'); From 780dc5ce08d422837e3bc86c81b568b13c3a9760 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 14:07:04 +0000 Subject: [PATCH 09/10] fix(app): keep a seeded auto granularity on a live dashboard's fullscreen view Co-authored-by: Mike Shi --- packages/app/src/DBDashboardPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index f6814babf..b49000902 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -642,7 +642,9 @@ const Tile = ({ fullscreenView?.dateRange ?? fullscreenSeed?.dateRange ?? dateRange; const fullscreenGranularity: Granularity | 'auto' = fullscreenView?.granularity ?? - ((fullscreenSeed?.granularity ?? granularity) as Granularity | undefined) ?? + ((fullscreenSeed ? fullscreenSeed.granularity : granularity) as + | Granularity + | undefined) ?? 'auto'; // Rewrite the picker text on open and when the range changes from outside From ec8ab4df424d73138c7d87fc530490c97b15c6ee Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 1 Dec 2026 14:15:02 +0000 Subject: [PATCH 10/10] fix(app): use a stable key map for the fullscreen URL state Co-authored-by: Mike Shi --- packages/app/src/DBDashboardPage.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/app/src/DBDashboardPage.tsx b/packages/app/src/DBDashboardPage.tsx index b49000902..4f9fee0ab 100644 --- a/packages/app/src/DBDashboardPage.tsx +++ b/packages/app/src/DBDashboardPage.tsx @@ -492,6 +492,17 @@ type FullscreenTileView = { granularity?: Granularity | 'auto'; }; +// Module-level so useQueryStates gets a stable key map and setter. +const fullscreenQueryStateMap = { + fullscreenTileId: parseAsString, + fullscreenFrom: parseAsFloat, + fullscreenTo: parseAsFloat, + fullscreenGranularity: parseAsStringEnum([ + ...Object.values(Granularity), + 'auto', + ]), +}; + const Tile = ({ chart, dateRange, @@ -2049,15 +2060,7 @@ function DBDashboardPage({ // `granularity` so fullscreen changes don't refetch every dashboard tile. // Pushed (not replaced) so back/forward steps through them. const [fullscreenState, setFullscreenState] = useQueryStates( - { - fullscreenTileId: parseAsString, - fullscreenFrom: parseAsFloat, - fullscreenTo: parseAsFloat, - fullscreenGranularity: parseAsStringEnum([ - ...Object.values(Granularity), - 'auto', - ]), - }, + fullscreenQueryStateMap, { history: 'push' }, ); const { fullscreenTileId, fullscreenFrom, fullscreenTo } = fullscreenState;