@athenaintel/react 0.10.5 → 0.10.7

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
@@ -66627,28 +66627,33 @@ function ThreadListItem() {
66627
66627
  }
66628
66628
  function useAthenaThreadManager() {
66629
66629
  const runtime = useAssistantRuntime({ optional: true });
66630
- const threadId = useThread({ optional: true, selector: (s) => s.threadId });
66631
- const threadList = useThreadList({ optional: true });
66630
+ const remoteId = useThread({ optional: true, selector: (s) => {
66631
+ var _a2;
66632
+ return (_a2 = s.metadata) == null ? void 0 : _a2.remoteId;
66633
+ } });
66634
+ const isLoading = useThreadList({ optional: true, selector: (s) => s.isLoading });
66635
+ const runtimeRef = React.useRef(runtime);
66636
+ runtimeRef.current = runtime;
66632
66637
  const switchToThread = React.useCallback(
66633
- (id) => runtime.threads.switchToThread(id),
66634
- [runtime]
66638
+ (id) => runtimeRef.current.threads.switchToThread(id),
66639
+ []
66635
66640
  );
66636
66641
  const switchToNewThread = React.useCallback(
66637
- () => runtime.threads.switchToNewThread(),
66638
- [runtime]
66642
+ () => runtimeRef.current.threads.switchToNewThread(),
66643
+ []
66639
66644
  );
66645
+ const activeThreadId = remoteId ?? null;
66640
66646
  return React.useMemo(() => {
66641
- if (!runtime || !threadList) {
66647
+ if (!runtime || isLoading == null) {
66642
66648
  return null;
66643
66649
  }
66644
66650
  return {
66645
- activeThreadId: threadId ?? null,
66646
- threadIds: threadList.threadIds,
66647
- isLoading: threadList.isLoading,
66651
+ activeThreadId,
66652
+ isLoading,
66648
66653
  switchToThread,
66649
66654
  switchToNewThread
66650
66655
  };
66651
- }, [runtime, threadId, threadList, switchToThread, switchToNewThread]);
66656
+ }, [runtime, activeThreadId, isLoading, switchToThread, switchToNewThread]);
66652
66657
  }
66653
66658
  function useAppendToComposer() {
66654
66659
  const aui = useAui();