From 5925e1cdd8dc3a4ecee2f6043db371a35bfb8ced Mon Sep 17 00:00:00 2001 From: Hans Otto Wirtz Date: Tue, 11 Nov 2025 19:15:49 +0100 Subject: [PATCH 1/2] purge!: remove change event --- README.md | 30 +++++++++++-------- src/base-done-tracker.ts | 10 ------- src/components/ImperativeTrackDone.tsx | 2 -- src/components/TrackDone.tsx | 7 ----- src/done-tracker-interface.ts | 2 -- src/leaf-done-tracker.ts | 15 ---------- src/node-done-tracker.ts | 11 ------- src/stories/AsyncTree.stories.tsx | 1 - src/stories/Button.stories.tsx | 1 - src/stories/DelayedContainer.stories.tsx | 1 - .../DelayedContainerAndChildren.stories.tsx | 1 - src/stories/EmptyNode.stories.tsx | 1 - src/stories/Image.stories.tsx | 1 - src/stories/ImmediatelyDone.stories.tsx | 1 - .../ImmediatelyDoneWithChildren.stories.tsx | 1 - src/stories/ImmediatelyErroring.stories.tsx | 1 - src/stories/ImperativeAsyncTree.stories.tsx | 1 - src/stories/ImperativeAsyncTree2.stories.tsx | 1 - src/stories/ImperativeAsyncTree3.stories.tsx | 1 - src/stories/ImperativeButton.stories.tsx | 1 - src/stories/ImperativeImage.stories.tsx | 1 - src/stories/ImperativeInput.stories.tsx | 1 - .../ImperativeRecursiveTree.stories.tsx | 1 - .../ImperativeSimpleAsyncTree.stories.tsx | 1 - src/stories/Intro.mdx | 1 - src/stories/Intro.stories.tsx | 1 - src/stories/MixedUsage.stories.tsx | 1 - src/stories/NestedTrackDone.stories.tsx | 1 - src/stories/PropDelayer.stories.tsx | 1 - src/stories/PropDelayerNoSubtree.stories.tsx | 1 - src/stories/RecursiveTree.stories.tsx | 1 - src/stories/Rerendering.stories.tsx | 1 - src/stories/Reset.stories.tsx | 1 - src/stories/SimpleAsyncTree.stories.tsx | 1 - src/stories/SlowHook.stories.tsx | 1 - src/stories/SlowHookFixed.stories.tsx | 1 - .../SlowHookFixedWithDelay.stories.tsx | 1 - .../SlowHookFixedWithEffectsDelay.stories.tsx | 1 - src/stories/StoryWrapper.tsx | 6 ---- src/stories/Suspense.stories.tsx | 1 - src/stories/UsingSkip.stories.tsx | 1 - src/stories/VeryDeep.stories.tsx | 1 - src/track-component-done.tsx | 3 +- src/use-done-tracker-subscription.ts | 9 ------ src/use-imperative-node-done-tracker.ts | 3 -- 45 files changed, 19 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 8d515b8..7fcc386 100644 --- a/README.md +++ b/README.md @@ -312,22 +312,28 @@ import { ForkLeafDoneTracker } from "react-done-tracker"; In certain situations, it's useful to know when the children of a certain component have changed, e.g. when you want to screenshot those components after a change. On first load, you can wait for a `done` event. But when the children change in a non-async way, there will not be a second `done` event. -Because of that, you can trigger the `change` event if you want a parent component to know that the children have changed. +Previously, this library had a `change` event, but we now recommend to provide your own change emitters: ```tsx -// child -useEffect(() => { - doneTracker.signalChange(); -}, [doneTracker, dep]); - -// parent -useDoneTrackerSubscription(doneTracker, { - change: () => console.log("children have changed") -}); +class ChangeEmitter { + private listeners: (() => void)[] = []; + emit = () => { + this.listeners.forEach((listener) => listener()); + } + subscribe = (listener: () => void) => { + this.listeners.push(listener); + return () => { + this.listeners.splice(this.listeners.indexOf(listener), 1); + }; + } + fork = (): ChangeEmitter => { + const emitter = new ChangeEmitter(); + this.listeners.push(emitter.emit); + return emitter; + } +} ``` -The `change` event is not part of the "core" of this library. It was added because it's commonly needed. - ## Caveats ### Slow hooks diff --git a/src/base-done-tracker.ts b/src/base-done-tracker.ts index 30a4588..637d5c0 100644 --- a/src/base-done-tracker.ts +++ b/src/base-done-tracker.ts @@ -11,7 +11,6 @@ export class BaseDoneTracker abortListeners: DoneTrackerListener<"abort">[] = []; errorListeners: DoneTrackerListener<"error">[] = []; resetListeners: DoneTrackerListener<"reset">[] = []; - changeListeners: DoneTrackerListener<"change">[] = []; addEventListener: DoneTracker["addEventListener"] = (event, listener) => { if (event === "done") { @@ -22,8 +21,6 @@ export class BaseDoneTracker this.errorListeners.push(listener as any); } else if (event === "reset") { this.resetListeners.push(listener as any); - } else if (event === "change") { - this.changeListeners.push(listener as any); } }; @@ -48,11 +45,6 @@ export class BaseDoneTracker this.resetListeners.indexOf(listener as any), 1 ); - } else if (event === "change") { - this.changeListeners.splice( - this.changeListeners.indexOf(listener as any), - 1 - ); } }; @@ -68,8 +60,6 @@ export class BaseDoneTracker this.errorListeners.forEach((fn) => fn(arg as any)); } else if (event === "reset") { this.resetListeners.forEach((fn) => fn(arg as any)); - } else if (event === "change") { - this.changeListeners.forEach((fn) => fn(arg as any)); } } } diff --git a/src/components/ImperativeTrackDone.tsx b/src/components/ImperativeTrackDone.tsx index e240ab5..6c8a4e5 100644 --- a/src/components/ImperativeTrackDone.tsx +++ b/src/components/ImperativeTrackDone.tsx @@ -12,7 +12,6 @@ export function ImperativeTrackDone({ onDone, onError, onPending, - onChange, }: TrackComponentDoneProps<{ children: (doneTracker: NodeDoneTracker) => any; forceRefreshRef?: MutableRefObject<(() => void) | null>; @@ -29,7 +28,6 @@ export function ImperativeTrackDone({ done: onDone, error: onError, pending: onPending, - change: onChange, }); return ( diff --git a/src/components/TrackDone.tsx b/src/components/TrackDone.tsx index 23c6043..56ec709 100644 --- a/src/components/TrackDone.tsx +++ b/src/components/TrackDone.tsx @@ -13,7 +13,6 @@ export function TrackDoneRoot({ onDone, onError, onPending, - onChange, }: TrackComponentDoneProps<{ children: any; forceRefreshRef?: MutableRefObject<(() => void) | null>; @@ -30,7 +29,6 @@ export function TrackDoneRoot({ done: onDone, error: onError, pending: onPending, - change: onChange, }); return ( @@ -46,7 +44,6 @@ export function ForkedTrackDone({ onDone, onError, onPending, - onChange, forceRefreshRef, }: TrackComponentDoneProps<{ name: string; @@ -64,7 +61,6 @@ export function ForkedTrackDone({ done: onDone, error: onError, pending: onPending, - change: onChange, }); return ( @@ -82,7 +78,6 @@ export function TrackDone({ onDone, onError, onPending, - onChange, }: TrackComponentDoneProps<{ children: any; forceRoot?: boolean; @@ -99,7 +94,6 @@ export function TrackDone({ onDone={onDone} onError={onError} onPending={onPending} - onChange={onChange} > {children} @@ -113,7 +107,6 @@ export function TrackDone({ onDone={onDone} onError={onError} onPending={onPending} - onChange={onChange} > {children} diff --git a/src/done-tracker-interface.ts b/src/done-tracker-interface.ts index 44c6598..f18f712 100644 --- a/src/done-tracker-interface.ts +++ b/src/done-tracker-interface.ts @@ -26,8 +26,6 @@ export interface DoneTracker { readonly erroredAt: number | null; readonly pendingAt: number; - readonly preventChangePropagation: boolean; - addEventListener(event: K, listener: DoneTrackerListener): void; removeEventListener(event: K, listener: DoneTrackerListener): void; diff --git a/src/leaf-done-tracker.ts b/src/leaf-done-tracker.ts index 64f5fec..f35b58d 100644 --- a/src/leaf-done-tracker.ts +++ b/src/leaf-done-tracker.ts @@ -16,8 +16,6 @@ export class LeafDoneTracker extends BaseDoneTracker implements DoneTracker { private _erroredAt: number | null = null; private _pendingAt: number = performance.now(); - public preventChangePropagation = false; - get id() { return this._name ? `${this._id}:${this._name}` : this._id; } @@ -127,19 +125,6 @@ export class LeafDoneTracker extends BaseDoneTracker implements DoneTracker { this.dispatchEvent("error", err, this); }; - signalChange = () => { - if (this.aborted) { - warn("Already aborted, can't signal change", this.id); - return; - } - if (!this.done) { - debug("Not done, not signaling change", this.id); - return; - } - log("🌀 Signaling changed", this.id, "after"); - this.dispatchEvent("change"); - }; - reset = () => { if (this.aborted) { warn("Already aborted, can't repend", this.id); diff --git a/src/node-done-tracker.ts b/src/node-done-tracker.ts index d816779..c1ae9a3 100644 --- a/src/node-done-tracker.ts +++ b/src/node-done-tracker.ts @@ -24,8 +24,6 @@ export class NodeDoneTracker extends BaseDoneTracker implements DoneTracker { private _erroredAt: number | null = null; private _pendingAt: number = performance.now(); - public preventChangePropagation = false; - get id() { return this._name ? `${this._id}:${this._name}` : this._id; } @@ -131,15 +129,6 @@ export class NodeDoneTracker extends BaseDoneTracker implements DoneTracker { if (!canReset) return; this.reset(); }); - if (!child.preventChangePropagation) { - child.addEventListener("change", () => { - debug("Child of", this.id, "changed"); - if (!this.done) return; - // needs to be available for useDoneTrackerSubscription - this.dispatchEvent("change"); - }); - } - if (child.done) { debug("Child was already done when added", child.id); this.checkAndDispatchState(); diff --git a/src/stories/AsyncTree.stories.tsx b/src/stories/AsyncTree.stories.tsx index d670692..34d24cf 100644 --- a/src/stories/AsyncTree.stories.tsx +++ b/src/stories/AsyncTree.stories.tsx @@ -41,7 +41,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index 0b6e954..9773bd8 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -14,7 +14,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/DelayedContainer.stories.tsx b/src/stories/DelayedContainer.stories.tsx index 6f49090..4cf449e 100644 --- a/src/stories/DelayedContainer.stories.tsx +++ b/src/stories/DelayedContainer.stories.tsx @@ -16,7 +16,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], }; diff --git a/src/stories/DelayedContainerAndChildren.stories.tsx b/src/stories/DelayedContainerAndChildren.stories.tsx index 8205846..74db187 100644 --- a/src/stories/DelayedContainerAndChildren.stories.tsx +++ b/src/stories/DelayedContainerAndChildren.stories.tsx @@ -24,7 +24,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/EmptyNode.stories.tsx b/src/stories/EmptyNode.stories.tsx index d3b0d1b..4a0237f 100644 --- a/src/stories/EmptyNode.stories.tsx +++ b/src/stories/EmptyNode.stories.tsx @@ -19,7 +19,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); const Tree = () => { diff --git a/src/stories/Image.stories.tsx b/src/stories/Image.stories.tsx index 13bc304..7aa9e53 100644 --- a/src/stories/Image.stories.tsx +++ b/src/stories/Image.stories.tsx @@ -15,7 +15,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/ImmediatelyDone.stories.tsx b/src/stories/ImmediatelyDone.stories.tsx index 26db4b5..107e390 100644 --- a/src/stories/ImmediatelyDone.stories.tsx +++ b/src/stories/ImmediatelyDone.stories.tsx @@ -30,7 +30,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/ImmediatelyDoneWithChildren.stories.tsx b/src/stories/ImmediatelyDoneWithChildren.stories.tsx index b3832e6..caa973c 100644 --- a/src/stories/ImmediatelyDoneWithChildren.stories.tsx +++ b/src/stories/ImmediatelyDoneWithChildren.stories.tsx @@ -24,7 +24,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/ImmediatelyErroring.stories.tsx b/src/stories/ImmediatelyErroring.stories.tsx index c1e2a47..42770f5 100644 --- a/src/stories/ImmediatelyErroring.stories.tsx +++ b/src/stories/ImmediatelyErroring.stories.tsx @@ -30,7 +30,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/ImperativeAsyncTree.stories.tsx b/src/stories/ImperativeAsyncTree.stories.tsx index 343b3f0..2669e69 100644 --- a/src/stories/ImperativeAsyncTree.stories.tsx +++ b/src/stories/ImperativeAsyncTree.stories.tsx @@ -54,7 +54,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeAsyncTree2.stories.tsx b/src/stories/ImperativeAsyncTree2.stories.tsx index eefe789..6416bf0 100644 --- a/src/stories/ImperativeAsyncTree2.stories.tsx +++ b/src/stories/ImperativeAsyncTree2.stories.tsx @@ -115,7 +115,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeAsyncTree3.stories.tsx b/src/stories/ImperativeAsyncTree3.stories.tsx index e788442..ad0ef15 100644 --- a/src/stories/ImperativeAsyncTree3.stories.tsx +++ b/src/stories/ImperativeAsyncTree3.stories.tsx @@ -55,7 +55,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeButton.stories.tsx b/src/stories/ImperativeButton.stories.tsx index 3138645..200fe72 100644 --- a/src/stories/ImperativeButton.stories.tsx +++ b/src/stories/ImperativeButton.stories.tsx @@ -12,7 +12,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeImage.stories.tsx b/src/stories/ImperativeImage.stories.tsx index a2e422f..9fc589e 100644 --- a/src/stories/ImperativeImage.stories.tsx +++ b/src/stories/ImperativeImage.stories.tsx @@ -13,7 +13,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeInput.stories.tsx b/src/stories/ImperativeInput.stories.tsx index ecb5a16..265b4ba 100644 --- a/src/stories/ImperativeInput.stories.tsx +++ b/src/stories/ImperativeInput.stories.tsx @@ -40,7 +40,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeRecursiveTree.stories.tsx b/src/stories/ImperativeRecursiveTree.stories.tsx index 3b5a911..0e78519 100644 --- a/src/stories/ImperativeRecursiveTree.stories.tsx +++ b/src/stories/ImperativeRecursiveTree.stories.tsx @@ -99,7 +99,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/ImperativeSimpleAsyncTree.stories.tsx b/src/stories/ImperativeSimpleAsyncTree.stories.tsx index 90ee0e9..b30e63e 100644 --- a/src/stories/ImperativeSimpleAsyncTree.stories.tsx +++ b/src/stories/ImperativeSimpleAsyncTree.stories.tsx @@ -43,7 +43,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/Intro.mdx b/src/stories/Intro.mdx index 2feb009..d77a333 100644 --- a/src/stories/Intro.mdx +++ b/src/stories/Intro.mdx @@ -37,7 +37,6 @@ export const actions = { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }; # React Done Tracker diff --git a/src/stories/Intro.stories.tsx b/src/stories/Intro.stories.tsx index c25efe5..c9e9e3e 100644 --- a/src/stories/Intro.stories.tsx +++ b/src/stories/Intro.stories.tsx @@ -29,7 +29,6 @@ const actions = { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }; const VisualizedDelayedComponent = visualizeDoneWrapper(DelayedComponent); diff --git a/src/stories/MixedUsage.stories.tsx b/src/stories/MixedUsage.stories.tsx index 80ccc02..a60b20a 100644 --- a/src/stories/MixedUsage.stories.tsx +++ b/src/stories/MixedUsage.stories.tsx @@ -111,7 +111,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/NestedTrackDone.stories.tsx b/src/stories/NestedTrackDone.stories.tsx index a75913f..f6d51bc 100644 --- a/src/stories/NestedTrackDone.stories.tsx +++ b/src/stories/NestedTrackDone.stories.tsx @@ -39,7 +39,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/PropDelayer.stories.tsx b/src/stories/PropDelayer.stories.tsx index 5e23257..dd739f3 100644 --- a/src/stories/PropDelayer.stories.tsx +++ b/src/stories/PropDelayer.stories.tsx @@ -61,7 +61,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/PropDelayerNoSubtree.stories.tsx b/src/stories/PropDelayerNoSubtree.stories.tsx index 30ad726..bd96e2d 100644 --- a/src/stories/PropDelayerNoSubtree.stories.tsx +++ b/src/stories/PropDelayerNoSubtree.stories.tsx @@ -52,7 +52,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/RecursiveTree.stories.tsx b/src/stories/RecursiveTree.stories.tsx index e11a8f6..71af71e 100644 --- a/src/stories/RecursiveTree.stories.tsx +++ b/src/stories/RecursiveTree.stories.tsx @@ -82,7 +82,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/Rerendering.stories.tsx b/src/stories/Rerendering.stories.tsx index 3bf8562..29e8356 100644 --- a/src/stories/Rerendering.stories.tsx +++ b/src/stories/Rerendering.stories.tsx @@ -50,7 +50,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/Reset.stories.tsx b/src/stories/Reset.stories.tsx index f9b3c95..3b1c643 100644 --- a/src/stories/Reset.stories.tsx +++ b/src/stories/Reset.stories.tsx @@ -15,7 +15,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); const ForkNodeDoneTracker = imperativeToContextual( diff --git a/src/stories/SimpleAsyncTree.stories.tsx b/src/stories/SimpleAsyncTree.stories.tsx index eac4082..1fc5121 100644 --- a/src/stories/SimpleAsyncTree.stories.tsx +++ b/src/stories/SimpleAsyncTree.stories.tsx @@ -41,7 +41,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/SlowHook.stories.tsx b/src/stories/SlowHook.stories.tsx index fb8c01b..91984a9 100644 --- a/src/stories/SlowHook.stories.tsx +++ b/src/stories/SlowHook.stories.tsx @@ -10,7 +10,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/SlowHookFixed.stories.tsx b/src/stories/SlowHookFixed.stories.tsx index 7a784b8..61760ea 100644 --- a/src/stories/SlowHookFixed.stories.tsx +++ b/src/stories/SlowHookFixed.stories.tsx @@ -10,7 +10,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/SlowHookFixedWithDelay.stories.tsx b/src/stories/SlowHookFixedWithDelay.stories.tsx index 613157c..bc6f283 100644 --- a/src/stories/SlowHookFixedWithDelay.stories.tsx +++ b/src/stories/SlowHookFixedWithDelay.stories.tsx @@ -10,7 +10,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/SlowHookFixedWithEffectsDelay.stories.tsx b/src/stories/SlowHookFixedWithEffectsDelay.stories.tsx index 823065d..f8ce3aa 100644 --- a/src/stories/SlowHookFixedWithEffectsDelay.stories.tsx +++ b/src/stories/SlowHookFixedWithEffectsDelay.stories.tsx @@ -10,7 +10,6 @@ const { actions, actionsMockClear } = createSpyableActions({ onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }); export default { diff --git a/src/stories/StoryWrapper.tsx b/src/stories/StoryWrapper.tsx index b1dbe2b..916c809 100644 --- a/src/stories/StoryWrapper.tsx +++ b/src/stories/StoryWrapper.tsx @@ -24,7 +24,6 @@ export default function StoryWrapper(props: StoryWrapperProps) { onAbort, onError, onPending, - onChange, disableStrictMode, recreateDoneTrackerOnPropsChange, hideForceRefresh, @@ -115,11 +114,6 @@ export default function StoryWrapper(props: StoryWrapperProps) { onPending?.(); setStatus("pending"); }, [onPending])} - onChange={useCallback(() => { - console.log("Story wrapper status", "change"); - onChange?.(); - setStatus("done"); - }, [onChange])} > {children} diff --git a/src/stories/Suspense.stories.tsx b/src/stories/Suspense.stories.tsx index 14ee88d..de927aa 100644 --- a/src/stories/Suspense.stories.tsx +++ b/src/stories/Suspense.stories.tsx @@ -44,7 +44,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/UsingSkip.stories.tsx b/src/stories/UsingSkip.stories.tsx index 28add1a..d02c323 100644 --- a/src/stories/UsingSkip.stories.tsx +++ b/src/stories/UsingSkip.stories.tsx @@ -50,7 +50,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/stories/VeryDeep.stories.tsx b/src/stories/VeryDeep.stories.tsx index a3f8bf1..6c50c53 100644 --- a/src/stories/VeryDeep.stories.tsx +++ b/src/stories/VeryDeep.stories.tsx @@ -43,7 +43,6 @@ export default { onAbort: action("abort"), onError: action("error"), onPending: action("pending"), - onChange: action("change"), }), ], } as Meta; diff --git a/src/track-component-done.tsx b/src/track-component-done.tsx index 361d0a6..82f4eaf 100644 --- a/src/track-component-done.tsx +++ b/src/track-component-done.tsx @@ -5,5 +5,4 @@ export type TrackComponentDoneProps

= { onAbort?: () => void; onError?: (err: any, source: DoneTracker) => void; onPending?: () => void; - onChange?: () => void; -} & Omit; +} & Omit; diff --git a/src/use-done-tracker-subscription.ts b/src/use-done-tracker-subscription.ts index 8ad047a..eaf0e1b 100644 --- a/src/use-done-tracker-subscription.ts +++ b/src/use-done-tracker-subscription.ts @@ -8,12 +8,10 @@ export const useDoneTrackerSubscription = ( done, error, pending, - change, }: { done?: () => void; error?: (err: any, source: DoneTracker) => void; pending?: () => void; - change?: () => void; } ) => { useEffect(() => { @@ -60,11 +58,4 @@ export const useDoneTrackerSubscription = ( doneTracker.addEventListener("reset", fn); return () => doneTracker.removeEventListener("reset", fn); }, [doneTracker, pending]); - - useEffect(() => { - if (!change) return; - const fn = () => change(); - doneTracker.addEventListener("change", fn); - return () => doneTracker.removeEventListener("change", fn); - }, [doneTracker, change]); }; diff --git a/src/use-imperative-node-done-tracker.ts b/src/use-imperative-node-done-tracker.ts index e565db7..6c9b72d 100644 --- a/src/use-imperative-node-done-tracker.ts +++ b/src/use-imperative-node-done-tracker.ts @@ -8,7 +8,6 @@ export const useImperativeNodeDoneTracker = ( { name, skip = false, - preventChangePropagation = false }: { name?: string; /** @@ -20,7 +19,6 @@ export const useImperativeNodeDoneTracker = ( * When the children are rendered/registered, change it to false. */ skip?: boolean; - preventChangePropagation?: boolean; } = {} ) => { if (!doneTracker) @@ -29,7 +27,6 @@ export const useImperativeNodeDoneTracker = ( ); const localDoneTracker = useDoneTrackerRaw(doneTracker, "node", name); - if (preventChangePropagation) localDoneTracker.preventChangePropagation = true; useTemporarilySkipNodeDoneTracker(localDoneTracker, skip); // uncomment when we want to From e572f80b5c22d17006c803e9131497485f3051f1 Mon Sep 17 00:00:00 2001 From: Hans Otto Wirtz Date: Wed, 12 Nov 2025 10:56:49 +0100 Subject: [PATCH 2/2] chore: make storybook less verbose --- .storybook/preview-head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index 0dfddc7..91862f4 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -1,4 +1,4 @@