create-zerotal 1.8.1 → 1.10.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": "create-zerotal",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "Create a new Zerotal application",
5
5
  "license": "MIT",
6
6
  "maturity": "stable",
package/src/scaffold.ts CHANGED
@@ -13,7 +13,7 @@ export type Template = 'minimal' | 'api' | 'admin' | 'flow' | 'react' | 'vue';
13
13
  // "^1.1.0" found for specifier "zerotal"` — the first thing anyone trying the
14
14
  // framework saw. `scaffold.test.ts` now asserts the two agree, so CI fails rather
15
15
  // than the user's install.
16
- export const ZT_VERSION = "^1.8.1";
16
+ export const ZT_VERSION = "^1.10.0";
17
17
 
18
18
  export interface ScaffoldOptions {
19
19
  name: string;
@@ -1,5 +1,5 @@
1
1
  import { createInertiaApp, type ResolvedComponent } from "@inertiajs/react";
2
- import { createRoot } from "react-dom/client";
2
+ import { createRoot, hydrateRoot } from "react-dom/client";
3
3
  import { defineRoutes } from "zerotal/routes";
4
4
  import { pages } from "./pages.generated.ts";
5
5
  import { ROUTES } from "../../types/routes.generated.ts";
@@ -34,6 +34,15 @@ createInertiaApp({
34
34
  },
35
35
 
36
36
  setup({ el, App, props }) {
37
- createRoot(el).render(<App {...props} />);
37
+ // `inertiaStream()` and endpoint SSR mark the root they rendered into. Hydrate
38
+ // that markup rather than replacing it: it is already the right page, a scraper
39
+ // has already read the head tags out of it, and rendering a second time throws
40
+ // away the first paint the server just paid for.
41
+ const app = <App {...props} />;
42
+ if (el.hasAttribute("data-server-rendered")) {
43
+ hydrateRoot(el, app);
44
+ } else {
45
+ createRoot(el).render(app);
46
+ }
38
47
  },
39
48
  });