@blade-hq/agent-react 2610.0.0-beta.49 → 2610.0.0-beta.50

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
@@ -1147,7 +1147,7 @@ var X = createLucideIcon("X", [
1147
1147
  ]);
1148
1148
 
1149
1149
  // src/components/AgentChat.tsx
1150
- import { useCallback as useCallback8, useEffect as useEffect13, useMemo as useMemo8, useState as useState16 } from "react";
1150
+ import { useCallback as useCallback8, useEffect as useEffect13, useMemo as useMemo8, useRef as useRef14, useState as useState16 } from "react";
1151
1151
 
1152
1152
  // src/components/SessionPluginSelector.tsx
1153
1153
  import { useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
@@ -4844,6 +4844,12 @@ function ChatSessionView({
4844
4844
  const [resultFeedback, setResultFeedback] = useState16([]);
4845
4845
  const resolvedSessionId = session?.sessionId;
4846
4846
  const isViewer = state?.viewerRole === "viewer";
4847
+ const onSessionReadyRef = useRef14(onSessionReady);
4848
+ const readySessionRef = useRef14(null);
4849
+ const hasOnSessionReady = onSessionReady !== void 0;
4850
+ useEffect13(() => {
4851
+ onSessionReadyRef.current = onSessionReady;
4852
+ }, [onSessionReady]);
4847
4853
  useEffect13(() => {
4848
4854
  setResultFeedback([]);
4849
4855
  if (!resolvedSessionId || isViewer) return;
@@ -4880,10 +4886,11 @@ function ChatSessionView({
4880
4886
  ]);
4881
4887
  }, []);
4882
4888
  useEffect13(() => {
4883
- if (session) {
4884
- onSessionReady?.(session);
4885
- }
4886
- }, [session, onSessionReady]);
4889
+ const handler = onSessionReadyRef.current;
4890
+ if (!session || !hasOnSessionReady || !handler || readySessionRef.current === session) return;
4891
+ readySessionRef.current = session;
4892
+ handler(session);
4893
+ }, [session, hasOnSessionReady]);
4887
4894
  useEffect13(() => {
4888
4895
  if (!session) return;
4889
4896
  const offAttach = session.on("attachRequested", ({ label, content }) => {
@@ -5287,7 +5294,7 @@ function ContextGroupCard({ contexts, className }) {
5287
5294
  }
5288
5295
 
5289
5296
  // src/components/SessionMemoryToggle.tsx
5290
- import { useCallback as useCallback9, useEffect as useEffect15, useRef as useRef14, useState as useState19, useSyncExternalStore as useSyncExternalStore2 } from "react";
5297
+ import { useCallback as useCallback9, useEffect as useEffect15, useRef as useRef15, useState as useState19, useSyncExternalStore as useSyncExternalStore2 } from "react";
5291
5298
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5292
5299
  var saveStates = /* @__PURE__ */ new WeakMap();
5293
5300
  function getSaveState(client, sessionId) {
@@ -5346,7 +5353,7 @@ function SessionMemoryToggle({
5346
5353
  getSaving
5347
5354
  );
5348
5355
  const [draftEnabled, setDraftEnabled] = useState19(enabled);
5349
- const activeSessionIdRef = useRef14(sessionId);
5356
+ const activeSessionIdRef = useRef15(sessionId);
5350
5357
  activeSessionIdRef.current = sessionId;
5351
5358
  useEffect15(() => {
5352
5359
  setDraftEnabled(enabled);