@flytedan/flytebot-design-system 0.71.3 → 0.71.4

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/dist/index.cjs CHANGED
@@ -13616,6 +13616,8 @@ function useChatEngine(opts) {
13616
13616
  const serverCount = React70.useRef(0);
13617
13617
  const serverIds = React70.useRef(/* @__PURE__ */ new Set());
13618
13618
  const liveTurn = React70.useRef(null);
13619
+ const lastTurnOwn = React70.useRef(/* @__PURE__ */ new Set());
13620
+ const retired = React70.useRef(/* @__PURE__ */ new Set());
13619
13621
  const threadRef = React70.useRef(null);
13620
13622
  const mounted = React70.useRef(true);
13621
13623
  React70.useEffect(() => {
@@ -13664,7 +13666,7 @@ function useChatEngine(opts) {
13664
13666
  const ids = new Set(server.map((m) => m.id));
13665
13667
  serverCount.current = server.length;
13666
13668
  serverIds.current = ids;
13667
- const next = [...server.filter((m) => !ownIds.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
13669
+ const next = [...server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
13668
13670
  commit(turn && progress ? next.map((m) => m.id === turn.holderId ? foldProgress(m, progress) : m) : next);
13669
13671
  }
13670
13672
  function foldProgress(holder, progress) {
@@ -13883,6 +13885,8 @@ function useChatEngine(opts) {
13883
13885
  commit(listRef.current.filter((m) => m.id !== holderId));
13884
13886
  }
13885
13887
  } finally {
13888
+ const known = liveTurn.current.known;
13889
+ lastTurnOwn.current = new Set([...serverIds.current].filter((id2) => !known.has(id2)));
13886
13890
  liveTurn.current = null;
13887
13891
  abortRef.current = null;
13888
13892
  busyRef.current = false;
@@ -13944,6 +13948,7 @@ function useChatEngine(opts) {
13944
13948
  const turn = list[at];
13945
13949
  commit(list.slice(0, at));
13946
13950
  serverCount.current = Math.max(0, serverCount.current - 1);
13951
+ lastTurnOwn.current.forEach((id) => retired.current.add(id));
13947
13952
  stoppedRef.current = false;
13948
13953
  queueRef.current = [{ id: uid("q"), text: turn.text || "", attachments: turn.attachments }].concat(queueRef.current);
13949
13954
  setQueue(queueRef.current.slice());