@appfunnel-dev/sdk 2.0.0-canary.0 → 2.0.0-canary.1

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
@@ -960,17 +960,18 @@ function FunnelView({
960
960
  timer.current = { key: currentKey, enteredAt: now(), hidden: 0, hiddenSince: hidden ? now() : null };
961
961
  }, [currentKey, emitExit]);
962
962
  react.useEffect(() => () => emitExit(), [emitExit]);
963
+ const [isNavigating, startNav] = react.useTransition();
963
964
  const next = react.useCallback(() => {
964
965
  const target = nextPage(flow, currentKey, funnel.snapshot());
965
966
  const resolved = target ? experiments.slotOf[target] ?? target : target;
966
- if (resolved) setHistory((h) => [...h, resolved]);
967
+ if (resolved) startNav(() => setHistory((h) => [...h, resolved]));
967
968
  }, [flow, currentKey, funnel, experiments]);
968
969
  const back = react.useCallback(
969
- () => setHistory((h) => h.length > 1 ? h.slice(0, -1) : h),
970
+ () => startNav(() => setHistory((h) => h.length > 1 ? h.slice(0, -1) : h)),
970
971
  []
971
972
  );
972
973
  const go = react.useCallback(
973
- (key) => setHistory((h) => [...h, experiments.slotOf[key] ?? key]),
974
+ (key) => startNav(() => setHistory((h) => [...h, experiments.slotOf[key] ?? key])),
974
975
  [experiments]
975
976
  );
976
977
  const prefetched = react.useRef(/* @__PURE__ */ new Set());
@@ -999,7 +1000,8 @@ function FunnelView({
999
1000
  go,
1000
1001
  prefetch,
1001
1002
  nextCandidates,
1002
- canGoBack: history.length > 1
1003
+ canGoBack: history.length > 1,
1004
+ isNavigating
1003
1005
  };
1004
1006
  const renderKey = experiments.render[currentKey] ?? currentKey;
1005
1007
  const Current = components.get(renderKey);