@athenaintel/react 0.10.4 → 0.10.5

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