@ipxjs/refract 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ipxjs/refract",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "A minimal React-like virtual DOM library with an optional React compat layer",
5
5
  "type": "module",
6
6
  "main": "src/refract/index.ts",
@@ -33,14 +33,16 @@ function cleanupFiberEffects(fiber: Fiber): void {
33
33
  if (!fiber.hooks) return;
34
34
 
35
35
  for (const hook of fiber.hooks) {
36
- const state = hook.state as { cleanup?: () => void; pending?: boolean } | undefined;
37
- if (state?.cleanup) {
38
- state.cleanup();
39
- state.cleanup = undefined;
36
+ const state = hook.state;
37
+ if (!state || typeof state !== "object") continue;
38
+ const effectState = state as { cleanup?: () => void; pending?: boolean };
39
+ if (effectState.cleanup) {
40
+ effectState.cleanup();
41
+ effectState.cleanup = undefined;
40
42
  }
41
43
  // Prevent deferred passive effects from running on unmounted fibers
42
- if (state && "pending" in state) {
43
- state.pending = false;
44
+ if ("pending" in effectState) {
45
+ effectState.pending = false;
44
46
  }
45
47
  }
46
48
  }