@opengeni/react 6.0.0-canary.1 → 6.1.0

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/README.md CHANGED
@@ -598,6 +598,16 @@ state remains application-owned; durable draft and session state remain in
598
598
  callback return type. Custom loaders can use `createOlderHistoryLoadReceipt`
599
599
  and call `markCommitted` immediately before publishing their accepted older
600
600
  window.
601
+ - Newer history uses `hasNewer`, `loadingNewer`, and `loadNewer`. A failed
602
+ `loadNewer()` preserves the retained events and cursors, exposes the original
603
+ failure through `error`, and still rejects for the caller to handle. Pass
604
+ `onLoadNewer={loadNewer}` (or return its promise from your wrapper) to
605
+ `MessageTimeline`: it catches the request failure, shows the error and an
606
+ explicit **Retry later activity** action, and does not automatically retry
607
+ the failed boundary. A successful retry, jump to the start/latest window,
608
+ or session change clears that failure. Loading older rows alone does not
609
+ resolve a failed newer read. Late failures from a previous session are ignored.
610
+ A host that discards the promise must handle its own rejected request.
601
611
  - `useComposer(sessionId, { sendExtras, effectiveControl })` — revisioned private
602
612
  draft, Send, Steer, and workstream Pause/Resume state. `send()` appends in
603
613
  visible queue order (including while paused); `steer()` puts the new direction
@@ -2271,6 +2271,7 @@ function useSessionEvents(sessionId, options = {}) {
2271
2271
  const [eventWindow, setEventWindow] = useState(EMPTY_EVENT_WINDOW);
2272
2272
  const [connectionState, setConnectionState] = useState("idle");
2273
2273
  const [error, setError] = useState(null);
2274
+ const [newerError, setNewerError] = useState(null);
2274
2275
  const [hasOlder, setHasOlder] = useState(false);
2275
2276
  const [hasNewer, setHasNewer] = useState(false);
2276
2277
  const [sessionStatusProjection, setSessionStatusProjection] = useState(
@@ -2308,6 +2309,7 @@ function useSessionEvents(sessionId, options = {}) {
2308
2309
  const [stateStreamKey, setStateStreamKey] = useState(streamKey);
2309
2310
  useEffect(() => {
2310
2311
  navigationGenerationRef.current += 1;
2312
+ setNewerError(null);
2311
2313
  loadingOlderRef.current = false;
2312
2314
  loadingNewerRef.current = false;
2313
2315
  loadingOldestRef.current = false;
@@ -2720,6 +2722,7 @@ function useSessionEvents(sessionId, options = {}) {
2720
2722
  initialWindowLoadedRef.current = true;
2721
2723
  viewModeRef.current = "history";
2722
2724
  loadingOldestRef.current = false;
2725
+ setNewerError(null);
2723
2726
  startTransition(() => {
2724
2727
  if (status !== void 0) {
2725
2728
  setSessionStatusProjection(status);
@@ -2764,6 +2767,7 @@ function useSessionEvents(sessionId, options = {}) {
2764
2767
  return false;
2765
2768
  }
2766
2769
  if (window.events.length === 0) {
2770
+ setNewerError(null);
2767
2771
  hasNewerRef.current = false;
2768
2772
  setHasNewer(false);
2769
2773
  streamResumeSequenceRef.current = afterSequence;
@@ -2806,6 +2810,7 @@ function useSessionEvents(sessionId, options = {}) {
2806
2810
  resumeLive = true;
2807
2811
  }
2808
2812
  loadingNewerRef.current = false;
2813
+ setNewerError(null);
2809
2814
  startTransition(() => {
2810
2815
  if (status !== void 0) {
2811
2816
  setSessionStatusProjection(status);
@@ -2821,6 +2826,12 @@ function useSessionEvents(sessionId, options = {}) {
2821
2826
  });
2822
2827
  published = true;
2823
2828
  return newer;
2829
+ } catch (reason) {
2830
+ if (navigationGenerationRef.current !== generation) {
2831
+ return false;
2832
+ }
2833
+ setNewerError(reason instanceof Error ? reason : new Error(String(reason)));
2834
+ throw reason;
2824
2835
  } finally {
2825
2836
  if (!published && navigationGenerationRef.current === generation) {
2826
2837
  loadingNewerRef.current = false;
@@ -2834,6 +2845,7 @@ function useSessionEvents(sessionId, options = {}) {
2834
2845
  }
2835
2846
  loadingLatestRef.current = true;
2836
2847
  setLoadingLatest(true);
2848
+ setNewerError(null);
2837
2849
  let published = false;
2838
2850
  try {
2839
2851
  streamAbortRef.current?.abort();
@@ -2887,7 +2899,7 @@ function useSessionEvents(sessionId, options = {}) {
2887
2899
  loadOldest,
2888
2900
  loadingLatest: !identityMatches ? false : loadingLatest,
2889
2901
  jumpToLatest,
2890
- error: identityMatches ? error : null
2902
+ error: identityMatches ? newerError ?? error : null
2891
2903
  };
2892
2904
  }
2893
2905
  function boundBrowserSessionEventWindow(events, options = {}) {
@@ -3756,4 +3768,4 @@ export {
3756
3768
  isHumanInputEvent,
3757
3769
  useHumanInputRequests
3758
3770
  };
3759
- //# sourceMappingURL=chunk-PZ27MCZP.js.map
3771
+ //# sourceMappingURL=chunk-L2NBTKRX.js.map