@ipxjs/refract 0.14.0 → 0.15.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.14.0",
3
+ "version": "0.15.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",
@@ -37,6 +37,16 @@ export function useState<T>(initial: T | (() => T)): [T, (value: T | ((prev: T)
37
37
  if (!hook._setter) {
38
38
  hook._setter = (value: T | ((prev: T) => T)) => {
39
39
  if (!hook._fiber) return;
40
+ // Bail out for same-value direct updates with no pending queue (matches React behavior).
41
+ // This prevents infinite loops when setState(sameValue) is called in effects —
42
+ // e.g. MUI FormControl/InputBase calling setAdornedStart(false) repeatedly.
43
+ if (
44
+ typeof value !== "function" &&
45
+ Object.is(value, hook.state) &&
46
+ (!hook.queue || (hook.queue as unknown[]).length === 0)
47
+ ) {
48
+ return;
49
+ }
40
50
  const action = typeof value === "function"
41
51
  ? value as (prev: T) => T
42
52
  : () => value;