diff --git a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts index 0f506f151b8..e7fa3a1db62 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts @@ -3423,6 +3423,7 @@ export function useChat( ? { viewId: (c.currentView ? c.currentView.viewId : c.viewId) ?? undefined } : {}), ...('fileId' in c && c.fileId ? { fileId: c.fileId } : {}), + ...(c.kind === 'dashboard' ? { dashboardId: c.dashboardId } : {}), ...('folderId' in c && c.folderId ? { folderId: c.folderId } : {}), ...(c.kind === 'skill' && 'skillId' in c ? { skillId: c.skillId } : {}), ...(c.kind === 'integration' && 'blockType' in c ? { blockType: c.blockType } : {}), diff --git a/apps/sim/components/charts/time-series-chart.tsx b/apps/sim/components/charts/time-series-chart.tsx index 0417ba1677d..8554a8f4df0 100644 --- a/apps/sim/components/charts/time-series-chart.tsx +++ b/apps/sim/components/charts/time-series-chart.tsx @@ -19,11 +19,13 @@ export function TimeSeriesChart({ label, option, ...config }: TimeSeriesChartPro const valuesRef = useRef(null) const edges = useScrollEdges(valuesRef, { axis: 'x' }) const [readout, setReadout] = useState(null) + const hasValues = Boolean(readout?.values.length) return (
{ }) it('updates only at the expected revision and advances it', async () => { - const current = (await getWorkspaceDashboard('ws-a'))! + const current = (await insertWorkspaceDashboard('ws-c', 'first', 'user-1'))! const updated = await updateDashboardContent(current.id, 'edited', 'user-2', current.revision) expect(updated).toMatchObject({ content: 'edited', @@ -61,6 +61,6 @@ describe('dashboard repository in PostgreSQL', () => { updatedBy: 'user-2', }) expect(await updateDashboardContent(current.id, 'stale', 'user-3', current.revision)).toBeNull() - expect((await getWorkspaceDashboard('ws-a'))?.content).toBe('edited') + expect((await getWorkspaceDashboard('ws-c'))?.content).toBe('edited') }) }) diff --git a/apps/sim/lib/mothership/chat/display-message.test.ts b/apps/sim/lib/mothership/chat/display-message.test.ts index efd2f9d9ba9..a630b019053 100644 --- a/apps/sim/lib/mothership/chat/display-message.test.ts +++ b/apps/sim/lib/mothership/chat/display-message.test.ts @@ -208,6 +208,20 @@ describe('display-message', () => { ]) }) + it('keeps the dashboard id of a reopened dashboard mention', () => { + const display = toDisplayMessage({ + id: 'msg-dashboard', + role: 'user', + content: '@Dashboard', + timestamp: '2024-01-01T00:00:00.000Z', + contexts: [{ kind: 'dashboard', label: 'Dashboard', dashboardId: 'dashboard-1' }], + }) + + expect(display.contexts).toEqual([ + { kind: 'dashboard', label: 'Dashboard', dashboardId: 'dashboard-1' }, + ]) + }) + it.each(['pending', 'executing', 'awaiting_approval'])( 'shows a %s row of a stored message as interrupted, not running', (state) => { diff --git a/apps/sim/lib/mothership/chat/display-message.ts b/apps/sim/lib/mothership/chat/display-message.ts index c2710d16cdc..3c445ffcb34 100644 --- a/apps/sim/lib/mothership/chat/display-message.ts +++ b/apps/sim/lib/mothership/chat/display-message.ts @@ -149,6 +149,7 @@ function toDisplayContexts( ...(c.tableId ? { tableId: c.tableId } : {}), ...(c.viewId ? { viewId: c.viewId } : {}), ...(c.fileId ? { fileId: c.fileId } : {}), + ...(c.dashboardId ? { dashboardId: c.dashboardId } : {}), ...(c.folderId ? { folderId: c.folderId } : {}), ...(c.chatId ? { chatId: c.chatId } : {}), ...(c.blockType ? { blockType: c.blockType } : {}),