@vizij/orchestrator-react 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -118,6 +118,32 @@ export function App() {
118
118
 
119
119
  ---
120
120
 
121
+ ## React 18 & Next.js Notes
122
+
123
+ - `OrchestratorProvider` now resets its internal mount flag on every effect pass, so React 18 Strict Mode (including Next.js dev builds) no longer leaves the provider stuck in “not ready”. If you previously worked around this by disabling Strict Mode, you can remove that patch.
124
+ - When you consume `@vizij/orchestrator-wasm` (and other Vizij wasm packages) in Webpack/Next.js, enable async WebAssembly and treat `.wasm` files as emitted assets:
125
+
126
+ ```js
127
+ // next.config.js
128
+ module.exports = {
129
+ webpack: (config) => {
130
+ config.experiments = {
131
+ ...(config.experiments ?? {}),
132
+ asyncWebAssembly: true,
133
+ };
134
+ config.module.rules.push({
135
+ test: /\.wasm$/,
136
+ type: "asset/resource",
137
+ });
138
+ return config;
139
+ },
140
+ };
141
+ ```
142
+
143
+ If you override `init()` with a custom wasm location, prefer string URLs (`init("https://cdn.example.com/vizij_orchestrator_wasm_bg.wasm")`) so Webpack doesn’t wrap them in `RelativeURL`.
144
+
145
+ ---
146
+
121
147
  ## Core Concepts
122
148
 
123
149
  ### Provider Props
package/dist/index.cjs CHANGED
@@ -94,12 +94,12 @@ function OrchestratorProvider({
94
94
  autostart = false
95
95
  }) {
96
96
  const mountedRef = (0, import_react2.useRef)(true);
97
- (0, import_react2.useEffect)(
98
- () => () => {
97
+ (0, import_react2.useEffect)(() => {
98
+ mountedRef.current = true;
99
+ return () => {
99
100
  mountedRef.current = false;
100
- },
101
- []
102
- );
101
+ };
102
+ }, []);
103
103
  const initPromiseRef = (0, import_react2.useRef)(null);
104
104
  const orchestratorRef = (0, import_react2.useRef)(null);
105
105
  const createPromiseRef = (0, import_react2.useRef)(null);
package/dist/index.js CHANGED
@@ -71,12 +71,12 @@ function OrchestratorProvider({
71
71
  autostart = false
72
72
  }) {
73
73
  const mountedRef = useRef(true);
74
- useEffect(
75
- () => () => {
74
+ useEffect(() => {
75
+ mountedRef.current = true;
76
+ return () => {
76
77
  mountedRef.current = false;
77
- },
78
- []
79
- );
78
+ };
79
+ }, []);
80
80
  const initPromiseRef = useRef(null);
81
81
  const orchestratorRef = useRef(null);
82
82
  const createPromiseRef = useRef(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizij/orchestrator-react",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -37,7 +37,7 @@
37
37
  "prepack": "pnpm run build && pnpm run test && pnpm run typecheck"
38
38
  },
39
39
  "dependencies": {
40
- "@vizij/orchestrator-wasm": "^0.2.3",
40
+ "@vizij/orchestrator-wasm": "^0.2.5",
41
41
  "@vizij/value-json": "^0.1.0"
42
42
  },
43
43
  "peerDependencies": {