@athenaintel/react 0.10.5 → 0.10.6

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