@jxsuite/runtime 1.3.0 → 1.3.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/dist/runtime.js +11 -3
- package/dist/runtime.js.map +4 -4
- package/package.json +3 -3
- package/src/runtime.ts +31 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/runtime",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "JSON-native reactive web component runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"upgrade": "bunx npm-check-updates -u && bun install"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@jxsuite/schema": "^1.
|
|
33
|
+
"@jxsuite/schema": "^1.5.0",
|
|
34
34
|
"@vue/reactivity": "3.5.40"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@happy-dom/global-registrator": "^20.11.
|
|
37
|
+
"@happy-dom/global-registrator": "^20.11.1"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/runtime.ts
CHANGED
|
@@ -170,6 +170,25 @@ export function setSkipServerFunctions(v: boolean) {
|
|
|
170
170
|
_serverFnConfig.skip = v;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/** @type {{ skip: boolean }} */
|
|
174
|
+
const _autoRequestConfig = { skip: false };
|
|
175
|
+
/**
|
|
176
|
+
* Set to true to suppress AUTOMATIC `$prototype: "Request"` fetches — the sibling of
|
|
177
|
+
* {@link setSkipServerFunctions}, and used by Studio for the same reason.
|
|
178
|
+
*
|
|
179
|
+
* `buildScope` re-resolves every `state` entry on each full canvas render, so an auto-request
|
|
180
|
+
* re-issued its HTTP call every time the canvas rebuilt. In edit/design mode that meant authoring
|
|
181
|
+
* actions — a signal edit, or pressing Enter inside component-wrapped content, both of which force
|
|
182
|
+
* a full render — fired network requests. Live data belongs to preview and to the deployed site.
|
|
183
|
+
*
|
|
184
|
+
* Only non-`manual` requests are gated: a `manual` one fires from an event handler, and edit mode
|
|
185
|
+
* strips handlers before rendering. The returned ref is unchanged either way — it simply stays at
|
|
186
|
+
* its initial `null`, which is the same state bindings observe before any fetch resolves.
|
|
187
|
+
*/
|
|
188
|
+
export function setSkipAutoRequests(v: boolean) {
|
|
189
|
+
_autoRequestConfig.skip = v;
|
|
190
|
+
}
|
|
191
|
+
|
|
173
192
|
// ─── Dev-proxy auth token (Studio cross-origin canvas) ────────────────────────
|
|
174
193
|
// The Studio canvas iframe is served from a token-gated loopback origin (createProjectServer): its
|
|
175
194
|
// POST /__jx_resolve__ + /__jx_server__ routes 403 without ?token=<rpcToken>. The iframe boot reads
|
|
@@ -773,6 +792,17 @@ export function renderNode(
|
|
|
773
792
|
}
|
|
774
793
|
|
|
775
794
|
if (def.$props) {
|
|
795
|
+
// A hyphenated tag carrying $props is a component instance whose definition has not finished
|
|
796
|
+
// Registering yet (async defineElement — e.g. the Studio desktop canvas, where the component
|
|
797
|
+
// Fetch can land after this node renders). Render via the property-first path anyway: it sets
|
|
798
|
+
// The instance props as JS properties on the bare element, which the eventual upgrade's
|
|
799
|
+
// ConnectedCallback reads back off `this` (see the def.state merge below), so the instance's
|
|
800
|
+
// Props win. The old branch stripped the props here, so a late upgrade painted the component's
|
|
801
|
+
// State DEFAULTS instead ("0"/"DESCRIPTION" for every instance). A non-custom tag can never
|
|
802
|
+
// Upgrade, so it keeps the historical mergeProps-into-scope behavior.
|
|
803
|
+
if (tagName.includes("-")) {
|
|
804
|
+
return renderCustomElementWithProps(def, localState, options, path);
|
|
805
|
+
}
|
|
776
806
|
const { $props: _$props, ...rest } = def;
|
|
777
807
|
return renderNode(rest, mergeProps(def, localState), options);
|
|
778
808
|
}
|
|
@@ -1312,7 +1342,7 @@ export async function resolvePrototype(
|
|
|
1312
1342
|
const debounceMs = def.debounce ?? 0;
|
|
1313
1343
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1314
1344
|
|
|
1315
|
-
if (!def.manual) {
|
|
1345
|
+
if (!def.manual && !_autoRequestConfig.skip) {
|
|
1316
1346
|
effect(() => {
|
|
1317
1347
|
let url: string | undefined;
|
|
1318
1348
|
if (isTemplateString(def.url)) {
|