@krate/runtime 0.3.0-beta.4 → 0.3.0-beta.5

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.
@@ -164,8 +164,10 @@ declare global {
164
164
  interface DOMAttributes {
165
165
  children?: unknown[] | unknown;
166
166
  key?: string | number;
167
- /** Assigns the mounted DOM element. Pass a mutable holder (`ref={myRef}`) or a callback (`ref={el => ...}`). */
168
- ref?: ((el: Element) => void) | Element | null;
167
+ /** Assigns the mounted DOM element. Pass a mutable holder (`ref={myRef}`), a callback (`ref={el => ...}`), or an element. */
168
+ ref?: ((el: Element) => void) | {
169
+ current: Element | null;
170
+ } | Element | null;
169
171
  slot?: string;
170
172
  style?: CSSProperties | string;
171
173
  part?: string;
@@ -611,7 +613,9 @@ declare global {
611
613
  interface SVGAttributes extends AriaAttributes {
612
614
  children?: unknown[] | unknown;
613
615
  key?: string | number;
614
- ref?: ((el: Element) => void) | Element | null;
616
+ ref?: ((el: Element) => void) | {
617
+ current: Element | null;
618
+ } | Element | null;
615
619
  style?: CSSProperties | string;
616
620
  class?: string;
617
621
  className?: string;
@@ -113,9 +113,14 @@ async function renderPage(req) {
113
113
  const mod = await loadPageModule(page);
114
114
  // Page-level data fetching (getStaticProps/getServerSideProps) has been
115
115
  // removed; per-request data is provided by server components (@server),
116
- // runtime components (@runtime), and middleware instead. The default export
117
- // is rendered here with no injected page props.
116
+ // runtime components (@runtime), and middleware instead. Dynamic-route
117
+ // params and query parameters extracted by the Go server are forwarded so
118
+ // `({ params }) => ...` pages receive their real values at render time.
118
119
  const props = {};
120
+ if (req.params)
121
+ props.params = req.params;
122
+ if (req.query)
123
+ props.query = req.query;
119
124
  // Get the default export (the component)
120
125
  const Component = mod.default;
121
126
  if (!Component) {
@@ -270,16 +275,22 @@ const server = http.createServer(async (req, res) => {
270
275
  res.end();
271
276
  return;
272
277
  }
278
+ // Per-request props (dynamic-route params + query) for both phases.
279
+ const props = {};
280
+ if (renderReq.params)
281
+ props.params = renderReq.params;
282
+ if (renderReq.query)
283
+ props.query = renderReq.query;
273
284
  // Phase 1: Render with empty props → Suspense shows fallback
274
285
  resetBoundaryCounter();
275
286
  setStreamingResolved(false);
276
- const fallbackJsx = Component({});
287
+ const fallbackJsx = Component(props);
277
288
  const fallbackHtml = renderToString(fallbackJsx);
278
289
  res.write(fallbackHtml);
279
290
  // Phase 2: Re-render with resolved props (no data-fetching needed)
280
291
  resetBoundaryCounter();
281
292
  setStreamingResolved(true);
282
- const resolvedJsx = Component({});
293
+ const resolvedJsx = Component(props);
283
294
  const resolvedHtml = renderToString(resolvedJsx);
284
295
  setStreamingResolved(false);
285
296
  // Extract resolved content per Suspense boundary from markers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krate/runtime",
3
- "version": "0.3.0-beta.4",
3
+ "version": "0.3.0-beta.5",
4
4
  "description": "Client-side runtime for Krate — signals, hydration, SPA router, resources, and context.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",