@dbx-tools/ui-mastra 0.9.153 → 0.9.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/ui-mastra";
6
- export const PACKAGE_VERSION = "0.9.153";
6
+ export const PACKAGE_VERSION = "0.9.154";
7
7
  export * as reactBubbles from "./src/react/bubbles.tsx";
8
8
  export * as reactChatApprovals from "./src/react/chat-approvals.ts";
9
9
  export * as reactChatComposer from "./src/react/chat-composer.tsx";
package/package.json CHANGED
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@databricks/appkit-ui": "0.81.0",
33
- "@dbx-tools/shared-core": "^0.9.153",
34
- "@dbx-tools/shared-genie": "^0.9.153",
35
- "@dbx-tools/shared-mastra": "^0.9.153",
36
- "@dbx-tools/shared-model": "^0.9.153",
37
- "@dbx-tools/ui": "^0.9.153",
33
+ "@dbx-tools/shared-core": "^0.9.154",
34
+ "@dbx-tools/shared-genie": "^0.9.154",
35
+ "@dbx-tools/shared-mastra": "^0.9.154",
36
+ "@dbx-tools/shared-model": "^0.9.154",
37
+ "@dbx-tools/ui": "^0.9.154",
38
38
  "@mastra/client-js": "1.50.0",
39
39
  "@mastra/core": "1.71.0",
40
40
  "@tanstack/react-table": "^8.21.3",
@@ -51,7 +51,7 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "version": "0.9.153",
54
+ "version": "0.9.154",
55
55
  "dbxToolsConfig": {
56
56
  "tags": [
57
57
  "ui"
@@ -152,9 +152,16 @@ export const ChatThreadLayout = ({
152
152
  };
153
153
 
154
154
  const [openTabIds, setOpenTabIds] = useState<string[]>([]);
155
+ const tabsSeededRef = useRef(false);
155
156
  useEffect(() => {
156
157
  if (!tabbedThreads) return;
157
- setOpenTabIds((previous) => syncThreadTabs(previous, threads ?? [], activeThreadId));
158
+ const seed = !tabsSeededRef.current;
159
+ tabsSeededRef.current = true;
160
+ setOpenTabIds((previous) =>
161
+ syncThreadTabs(previous, threads ?? [], activeThreadId, {
162
+ seed,
163
+ }),
164
+ );
158
165
  }, [tabbedThreads, threads, activeThreadId]);
159
166
 
160
167
  const closeTab = (threadId: string) => {
@@ -17,6 +17,14 @@ import type { ThreadSummary } from "../react/types.ts";
17
17
  */
18
18
  export const THREAD_TAB_SEED_MAX = 5;
19
19
 
20
+ /** Controls one reconciliation pass for the top conversation tabs. */
21
+ interface SyncThreadTabsOptions {
22
+ /** Seed recent conversations when no tabs remain. Defaults to true. */
23
+ readonly seed?: boolean;
24
+ /** Maximum recent conversations included by an initial seed. */
25
+ readonly seedMax?: number;
26
+ }
27
+
20
28
  /**
21
29
  * Reconcile the open tabs against the current thread list and selection:
22
30
  * drop tabs whose conversation no longer exists, seed from the newest
@@ -31,11 +39,13 @@ export function syncThreadTabs(
31
39
  openIds: string[],
32
40
  threads: ThreadSummary[],
33
41
  activeThreadId?: string,
34
- seedMax: number = THREAD_TAB_SEED_MAX,
42
+ options: SyncThreadTabsOptions = {},
35
43
  ): string[] {
36
44
  const known = new Set(threads.map((thread) => thread.id));
37
45
  let next = openIds.filter((id) => known.has(id) || id === activeThreadId);
38
- if (next.length === 0) next = threads.slice(0, seedMax).map((thread) => thread.id);
46
+ if (next.length === 0 && (options.seed ?? true)) {
47
+ next = threads.slice(0, options.seedMax ?? THREAD_TAB_SEED_MAX).map((thread) => thread.id);
48
+ }
39
49
  if (activeThreadId && !next.includes(activeThreadId)) next = [...next, activeThreadId];
40
50
  const unchanged = next.length === openIds.length && next.every((id, i) => id === openIds[i]);
41
51
  return unchanged ? openIds : next;