@taujs/react 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -157,10 +157,13 @@ function hydrateApp({
157
157
  onSuccess
158
158
  }) {
159
159
  const { log, warn, error } = createUILogger(logger, { debugCategory: "ssr", context: { scope: "react-hydration" }, enableDebug });
160
- const mountCSR = (rootEl) => {
160
+ const mountCSR = (rootEl, initialData) => {
161
161
  rootEl.innerHTML = "";
162
+ const store = createSSRStore(initialData);
162
163
  const root = createRoot(rootEl);
163
- root.render(/* @__PURE__ */ jsx2(React2.StrictMode, { children: appComponent }));
164
+ root.render(
165
+ /* @__PURE__ */ jsx2(React2.StrictMode, { children: /* @__PURE__ */ jsx2(SSRStoreProvider, { store, children: appComponent }) })
166
+ );
164
167
  };
165
168
  const startHydration = (rootEl, initialData) => {
166
169
  if (enableDebug) log("Hydration started");
@@ -193,8 +196,9 @@ function hydrateApp({
193
196
  }
194
197
  const data = window[dataKey];
195
198
  if (data === void 0) {
199
+ const data2 = {};
196
200
  if (enableDebug) warn(`No initial SSR data at window["${dataKey}"]. Mounting CSR.`);
197
- mountCSR(rootEl);
201
+ mountCSR(rootEl, data2);
198
202
  return;
199
203
  }
200
204
  startHydration(rootEl, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taujs/react",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "taujs | τjs",
5
5
  "author": "Aoede <taujs@aoede.uk.net> (https://www.aoede.uk.net)",
6
6
  "license": "MIT",