@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.js CHANGED
@@ -66589,27 +66589,31 @@ function ThreadListItem() {
66589
66589
  function useAthenaThreadManager() {
66590
66590
  const runtime = useAssistantRuntime({ optional: true });
66591
66591
  const threadId = useThread({ optional: true, selector: (s) => s.threadId });
66592
- const threadList = useThreadList({ optional: true });
66592
+ const threadIds = useThreadList({ optional: true, selector: (s) => s.threadIds });
66593
+ const isLoading = useThreadList({ optional: true, selector: (s) => s.isLoading });
66594
+ const runtimeRef = useRef(runtime);
66595
+ runtimeRef.current = runtime;
66593
66596
  const switchToThread = useCallback(
66594
- (id) => runtime.threads.switchToThread(id),
66595
- [runtime]
66597
+ (id) => runtimeRef.current.threads.switchToThread(id),
66598
+ []
66596
66599
  );
66597
66600
  const switchToNewThread = useCallback(
66598
- () => runtime.threads.switchToNewThread(),
66599
- [runtime]
66601
+ () => runtimeRef.current.threads.switchToNewThread(),
66602
+ []
66600
66603
  );
66604
+ const activeThreadId = threadId ?? null;
66601
66605
  return useMemo(() => {
66602
- if (!runtime || !threadList) {
66606
+ if (!runtime || threadIds == null || isLoading == null) {
66603
66607
  return null;
66604
66608
  }
66605
66609
  return {
66606
- activeThreadId: threadId ?? null,
66607
- threadIds: threadList.threadIds,
66608
- isLoading: threadList.isLoading,
66610
+ activeThreadId,
66611
+ threadIds,
66612
+ isLoading,
66609
66613
  switchToThread,
66610
66614
  switchToNewThread
66611
66615
  };
66612
- }, [runtime, threadId, threadList, switchToThread, switchToNewThread]);
66616
+ }, [runtime, activeThreadId, threadIds, isLoading, switchToThread, switchToNewThread]);
66613
66617
  }
66614
66618
  function useAppendToComposer() {
66615
66619
  const aui = useAui();