@texaryn/react 0.5.0 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @texaryn/react
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 5f510b7: `useForm` works inside `<StrictMode>`, which Vite's React template and the
8
+ Next.js App Router turn on by default. In development StrictMode runs every
9
+ effect's cleanup and setup a second time, and that cleanup destroyed the
10
+ runtime, so the form ignored typing and Submit did nothing.
11
+
12
+ The destroy now waits one task after the cleanup and the repeated setup cancels
13
+ it, so the form keeps its mounted runtime and that runtime's state. A real
14
+ unmount still destroys the runtime, one task later: a test that expects
15
+ `runtime.destroy()` to have run right after `unmount()` has to wait for the
16
+ next task. Work in flight at unmount, for example a submit dispatched just
17
+ before the component unmounts, now completes if it settles within the next
18
+ task, instead of being dropped.
19
+
20
+ ## 0.5.1
21
+
22
+ ### Patch Changes
23
+
24
+ - d3ea7a8: `homepage` points at the documentation site, https://texaryn.github.io/texaryn/,
25
+ instead of the GitHub README. No code changes.
26
+ - Updated dependencies [d3ea7a8]
27
+ - Updated dependencies [d3ea7a8]
28
+ - @texaryn/core@0.12.1
29
+
3
30
  ## 0.5.0
4
31
 
5
32
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,UAAU,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CACpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CA4Bf"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,UAAU,EACX,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,UAAU,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,eAAe,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;CACpD;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CAsCf"}
@@ -7,9 +7,19 @@ export function useForm(port, options) {
7
7
  runtimeRef.current = createFormRuntime(port, options);
8
8
  }
9
9
  const runtime = runtimeRef.current;
10
+ const pendingDestroy = useRef(null);
11
+ // StrictMode reruns cleanup then setup synchronously in one commit, so that
12
+ // setup cancels the deferred destroy. After a real unmount the destroy runs.
10
13
  useEffect(() => {
14
+ if (pendingDestroy.current !== null) {
15
+ clearTimeout(pendingDestroy.current);
16
+ pendingDestroy.current = null;
17
+ }
11
18
  return () => {
12
- runtime.destroy();
19
+ pendingDestroy.current = setTimeout(() => {
20
+ pendingDestroy.current = null;
21
+ runtime.destroy();
22
+ }, 0);
13
23
  };
14
24
  }, [runtime]);
15
25
  const document = useStore(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AAQ,CAAC,CAAA;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE/C,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAAgB,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,EACnD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,MAAc,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAChD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;AACxE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@texaryn/react",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "React bindings, hooks, prop getters, and default widgets for Texaryn",
5
5
  "keywords": [
6
6
  "react",
@@ -24,7 +24,7 @@
24
24
  "url": "git+https://github.com/texaryn/texaryn.git",
25
25
  "directory": "packages/react"
26
26
  },
27
- "homepage": "https://github.com/texaryn/texaryn#readme",
27
+ "homepage": "https://texaryn.github.io/texaryn/",
28
28
  "bugs": {
29
29
  "url": "https://github.com/texaryn/texaryn/issues"
30
30
  },
@@ -44,7 +44,7 @@
44
44
  "CHANGELOG.md"
45
45
  ],
46
46
  "dependencies": {
47
- "@texaryn/core": "^0.12.0"
47
+ "@texaryn/core": "^0.12.1"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "react": ">=18.0.0"
@@ -56,7 +56,7 @@
56
56
  "jsdom": "^25.0.0",
57
57
  "react": "^19.0.0",
58
58
  "react-dom": "^19.0.0",
59
- "@texaryn/schema-json": "0.6.1"
59
+ "@texaryn/schema-json": "0.6.3"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsc --build"