@lynx-js/react 0.129.0 → 0.129.1
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/CHANGELOG.md +14 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx +1 -1
- package/runtime/__test__/element-template/imports/no-legacy-imports.test.ts +7 -6
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +1 -2
- package/runtime/__test__/element-template/native/main-thread-api.test.ts +5 -2
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +83 -0
- package/runtime/__test__/element-template/native/reload-dual-thread-communication.test.ts +3 -0
- package/runtime/__test__/element-template/native/reload.test.ts +31 -2
- package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +15 -0
- package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +197 -7
- package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +101 -1
- package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +32 -0
- package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +121 -26
- package/runtime/__test__/element-template/test-utils/debug/envManager.ts +8 -5
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +35 -2
- package/runtime/__test__/guardrails/snapshot-containment.test.ts +45 -11
- package/runtime/__test__/shared/component-stack.test.ts +211 -0
- package/runtime/__test__/snapshot/debug/formatPatch.test.ts +0 -8
- package/runtime/__test__/snapshot/gesture/prepareGestureForCommit.test.js +1 -1
- package/runtime/__test__/snapshot/lynx/timing.test.jsx +3 -0
- package/runtime/__test__/snapshot/preact.test.jsx +0 -3
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +0 -33
- package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +12 -0
- package/runtime/__test__/worklet-runtime/loadRuntime.test.js +68 -0
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +30 -0
- package/runtime/lazy/element-template-internal.js +0 -1
- package/runtime/lazy/internal.js +1 -1
- package/runtime/lazy/jsx-dev-runtime.js +1 -1
- package/runtime/lazy/jsx-runtime.js +1 -1
- package/runtime/lazy/legacy-react-runtime.js +1 -1
- package/runtime/lazy/react-lepus.js +1 -1
- package/runtime/lazy/react.js +1 -1
- package/runtime/lib/core/capture-main-thread-object.js +2 -1
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.d.ts +125 -1
- package/runtime/lib/core/lynx-data-processors.js +3 -0
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/core/runtime-destroy.js +1 -1
- package/runtime/lib/core/runtime-destroy.js.map +1 -1
- package/runtime/lib/document.js +0 -5
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +11 -12
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/client/root.d.ts +1 -1
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -2
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +1 -1
- package/runtime/lib/element-template/internal.js +0 -13
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/native/flush.d.ts +1 -0
- package/runtime/lib/element-template/native/flush.js +9 -0
- package/runtime/lib/element-template/native/flush.js.map +1 -0
- package/runtime/lib/element-template/native/main-thread-api.js +3 -7
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +8 -2
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +57 -50
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +2 -1
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/root-instance.d.ts +0 -1
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js +4 -0
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js +4 -4
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +2 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +8 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +41 -21
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.d.ts +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/internal.d.ts +1 -1
- package/runtime/lib/internal.js +1 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +2 -125
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/shared/component-stack.d.ts +0 -4
- package/runtime/lib/shared/component-stack.js +21 -5
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/snapshot/gesture/{processGestureBagkround.js → processGestureBackground.js} +1 -1
- package/runtime/lib/snapshot/gesture/processGestureBackground.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +0 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +0 -5
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +0 -10
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +56 -51
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +0 -30
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +11 -8
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +0 -52
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +10 -10
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +0 -51
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/index.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +8 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +23 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +2 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +6 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +2 -0
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/capture-main-thread-object.ts +2 -1
- package/runtime/src/core/compat/legacy-react-runtime.ts +1 -1
- package/runtime/src/core/lynx/lazy-bundle.ts +1 -1
- package/runtime/src/core/lynx-data-processors.ts +124 -1
- package/runtime/src/core/runtime-destroy.ts +1 -1
- package/runtime/src/document.ts +0 -6
- package/runtime/src/element-template/background/commit-hook.ts +18 -12
- package/runtime/src/element-template/client/root.ts +1 -3
- package/runtime/src/element-template/index.ts +2 -2
- package/runtime/src/element-template/internal.ts +0 -20
- package/runtime/src/element-template/lynx/env.ts +1 -1
- package/runtime/src/element-template/native/flush.ts +10 -0
- package/runtime/src/element-template/native/main-thread-api.ts +3 -6
- package/runtime/src/element-template/native/mts-destroy.ts +7 -2
- package/runtime/src/element-template/native/patch-listener.ts +62 -57
- package/runtime/src/element-template/native/reload-main-thread.ts +2 -1
- package/runtime/src/element-template/protocol/types.ts +0 -13
- package/runtime/src/element-template/runtime/page/root-instance.ts +0 -1
- package/runtime/src/element-template/runtime/patch.ts +5 -0
- package/runtime/src/element-template/runtime/render/render-components.ts +3 -3
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +2 -0
- package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +8 -1
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +51 -21
- package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +2 -2
- package/runtime/src/element-template/types.d.ts +6 -0
- package/runtime/src/internal.ts +1 -1
- package/runtime/src/lynx-api.ts +2 -124
- package/runtime/src/shared/component-stack.ts +22 -5
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatch.ts +0 -5
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +0 -10
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +62 -58
- package/runtime/src/snapshot/list/listUpdateInfo.ts +0 -52
- package/runtime/src/snapshot/lynx/calledByNative.ts +11 -9
- package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +0 -58
- package/runtime/src/snapshot/renderToOpcodes/index.ts +8 -8
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +0 -57
- package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +1 -1
- package/runtime/src/worklet-runtime/README.md +30 -10
- package/runtime/src/worklet-runtime/bindings/index.ts +2 -0
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +25 -0
- package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +6 -0
- package/runtime/src/worklet-runtime/workletRuntime.ts +2 -0
- package/runtime/vitest.config.ts +0 -2
- package/testing-library/.turbo/turbo-build.log +6 -6
- package/testing-library/src/__tests__/act.test.jsx +0 -7
- package/testing-library/src/__tests__/alog.test.jsx +12 -54
- package/testing-library/src/__tests__/end-to-end.test.jsx +0 -7
- package/testing-library/src/__tests__/renderComponent.test.jsx +0 -14
- package/testing-library/src/__tests__/worklet.test.jsx +49 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +98 -376
- package/transform/__test__/defines.spec.js +30 -0
- package/transform/__test__/object-methods.spec.js +79 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +99 -49
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +56 -48
- package/transform/crates/swc_plugin_worklet/lib.rs +393 -589
- package/transform/crates/swc_plugin_worklet/napi.rs +4 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +6 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +7 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +12 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +1 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +1 -1
- package/transform/dist/wasm.cjs +1 -1
- package/transform/package.json +0 -1
- package/transform/src/lib.rs +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +113 -42
- package/transform/swc-plugin-reactlynx/src/lib.rs +1 -4
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +273 -66
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +0 -1
- package/runtime/lib/snapshot/worklet/hmr.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/hmr.js +0 -28
- package/runtime/lib/snapshot/worklet/hmr.js.map +0 -1
- package/runtime/src/snapshot/worklet/hmr.ts +0 -34
- /package/runtime/lib/snapshot/gesture/{processGestureBagkround.d.ts → processGestureBackground.d.ts} +0 -0
- /package/runtime/src/snapshot/gesture/{processGestureBagkround.ts → processGestureBackground.ts} +0 -0
|
@@ -16,6 +16,7 @@ class JsFunctionLifecycleManager {
|
|
|
16
16
|
private execIdSetToFire = new Set<number>();
|
|
17
17
|
private retainedObjects = new WeakSet<object>();
|
|
18
18
|
private willFire = false;
|
|
19
|
+
private active = true;
|
|
19
20
|
private registry: FinalizationRegistry<number>;
|
|
20
21
|
|
|
21
22
|
constructor() {
|
|
@@ -51,7 +52,12 @@ class JsFunctionLifecycleManager {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
dispose(): void {
|
|
56
|
+
this.active = false;
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
fire(): void {
|
|
60
|
+
if (!this.active) return;
|
|
55
61
|
profile('JsFunctionLifecycleManager.fire', () => {
|
|
56
62
|
lynx.getJSContext().dispatchEvent({
|
|
57
63
|
type: WorkletEvents.releaseBackgroundWorkletCtx,
|
|
@@ -17,6 +17,8 @@ import { profile } from './utils/profile.js';
|
|
|
17
17
|
import { getFromWorkletRefMap, initWorkletRef } from './workletRef.js';
|
|
18
18
|
|
|
19
19
|
function initWorklet(): void {
|
|
20
|
+
const previousManager = globalThis.lynxWorkletImpl?._jsFunctionLifecycleManager;
|
|
21
|
+
previousManager?.dispose();
|
|
20
22
|
globalThis.lynxWorkletImpl = {
|
|
21
23
|
_workletMap: {},
|
|
22
24
|
_refImpl: initWorkletRef(),
|
package/runtime/vitest.config.ts
CHANGED
|
@@ -142,7 +142,6 @@ export default defineConfig({
|
|
|
142
142
|
'src/element-template/**',
|
|
143
143
|
'src/core/hooks/mainThread.ts',
|
|
144
144
|
'src/core/hooks/mainThreadImpl.ts',
|
|
145
|
-
'src/shared/component-stack.ts',
|
|
146
145
|
'src/shared/profile.ts',
|
|
147
146
|
'src/index.ts',
|
|
148
147
|
'src/lynx-api.ts',
|
|
@@ -163,7 +162,6 @@ export default defineConfig({
|
|
|
163
162
|
'src/snapshot/lynx/tt.ts',
|
|
164
163
|
'src/snapshot/compat/componentIs.ts',
|
|
165
164
|
'src/snapshot/snapshot/types.ts',
|
|
166
|
-
'src/snapshot/worklet/hmr.ts',
|
|
167
165
|
|
|
168
166
|
'__test__/snapshot/page.test.jsx',
|
|
169
167
|
'**/*.d.ts',
|
|
@@ -3,13 +3,13 @@ Rslib v1.0.2
|
|
|
3
3
|
|
|
4
4
|
info build started...
|
|
5
5
|
start generating declaration files... (esm2)
|
|
6
|
-
ready built in 0.55s (esm2)
|
|
7
6
|
start generating declaration files... (esm0)
|
|
8
|
-
ready built in 0.
|
|
9
|
-
ready built in 0.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ready declaration files
|
|
7
|
+
ready built in 0.71s (esm2)
|
|
8
|
+
ready built in 0.82s (esm1)
|
|
9
|
+
ready built in 1.15s (esm0)
|
|
10
|
+
info declaration files prepared with tsgo in 1.45 s (esm2)
|
|
11
|
+
ready declaration files generated in 6.22 s (esm0)
|
|
12
|
+
ready declaration files bundled successfully: dist/index.d.ts in 3.79 s (esm2)
|
|
13
13
|
|
|
14
14
|
File (esm0) Size
|
|
15
15
|
dist/rslib-runtime-0.js 1.6 kB
|
|
@@ -305,13 +305,6 @@ test('fireEvent triggers useEffect calls', async () => {
|
|
|
305
305
|
{
|
|
306
306
|
"data": "{"patchList":[{"id":3,"snapshotPatch":[3,3,0,1]}]}",
|
|
307
307
|
"patchOptions": {
|
|
308
|
-
"pipelineOptions": {
|
|
309
|
-
"dsl": "reactLynx",
|
|
310
|
-
"needTimestamps": true,
|
|
311
|
-
"pipelineID": "pipelineID",
|
|
312
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
313
|
-
"stage": "hydrate",
|
|
314
|
-
},
|
|
315
308
|
"reloadVersion": 0,
|
|
316
309
|
},
|
|
317
310
|
},
|
|
@@ -298,14 +298,7 @@ describe('alog', () => {
|
|
|
298
298
|
]
|
|
299
299
|
},
|
|
300
300
|
"patchOptions": {
|
|
301
|
-
"reloadVersion": 0
|
|
302
|
-
"pipelineOptions": {
|
|
303
|
-
"pipelineID": "pipelineID",
|
|
304
|
-
"needTimestamps": true,
|
|
305
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
306
|
-
"dsl": "reactLynx",
|
|
307
|
-
"stage": "hydrate"
|
|
308
|
-
}
|
|
301
|
+
"reloadVersion": 0
|
|
309
302
|
}
|
|
310
303
|
}",
|
|
311
304
|
],
|
|
@@ -313,7 +306,7 @@ describe('alog', () => {
|
|
|
313
306
|
"[ReactLynxDebug] FiberElement API call #30: __SetAttribute(#text#6, "text", 1)",
|
|
314
307
|
],
|
|
315
308
|
[
|
|
316
|
-
"[ReactLynxDebug] FiberElement API call #31: __FlushElementTree(PAGE#0, {
|
|
309
|
+
"[ReactLynxDebug] FiberElement API call #31: __FlushElementTree(PAGE#0, {})",
|
|
317
310
|
],
|
|
318
311
|
]
|
|
319
312
|
`);
|
|
@@ -566,14 +559,7 @@ describe('alog', () => {
|
|
|
566
559
|
]
|
|
567
560
|
},
|
|
568
561
|
"patchOptions": {
|
|
569
|
-
"reloadVersion": 0
|
|
570
|
-
"pipelineOptions": {
|
|
571
|
-
"pipelineID": "pipelineID",
|
|
572
|
-
"needTimestamps": true,
|
|
573
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
574
|
-
"dsl": "reactLynx",
|
|
575
|
-
"stage": "hydrate"
|
|
576
|
-
}
|
|
562
|
+
"reloadVersion": 0
|
|
577
563
|
}
|
|
578
564
|
}",
|
|
579
565
|
],
|
|
@@ -581,7 +567,7 @@ describe('alog', () => {
|
|
|
581
567
|
"[ReactLynxDebug] FiberElement API call #30: __SetAttribute(#text#6, "text", 1)",
|
|
582
568
|
],
|
|
583
569
|
[
|
|
584
|
-
"[ReactLynxDebug] FiberElement API call #31: __FlushElementTree(PAGE#0, {
|
|
570
|
+
"[ReactLynxDebug] FiberElement API call #31: __FlushElementTree(PAGE#0, {})",
|
|
585
571
|
],
|
|
586
572
|
]
|
|
587
573
|
`);
|
|
@@ -626,14 +612,7 @@ describe('alog', () => {
|
|
|
626
612
|
]
|
|
627
613
|
},
|
|
628
614
|
"patchOptions": {
|
|
629
|
-
"reloadVersion": 0
|
|
630
|
-
"pipelineOptions": {
|
|
631
|
-
"pipelineID": "pipelineID",
|
|
632
|
-
"needTimestamps": true,
|
|
633
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
634
|
-
"dsl": "reactLynx",
|
|
635
|
-
"stage": "hydrate"
|
|
636
|
-
}
|
|
615
|
+
"reloadVersion": 0
|
|
637
616
|
}
|
|
638
617
|
}",
|
|
639
618
|
],
|
|
@@ -641,7 +620,7 @@ describe('alog', () => {
|
|
|
641
620
|
"[ReactLynxDebug] FiberElement API call #32: __SetAttribute(#text#6, "text", 0)",
|
|
642
621
|
],
|
|
643
622
|
[
|
|
644
|
-
"[ReactLynxDebug] FiberElement API call #33: __FlushElementTree(PAGE#0, {
|
|
623
|
+
"[ReactLynxDebug] FiberElement API call #33: __FlushElementTree(PAGE#0, {})",
|
|
645
624
|
],
|
|
646
625
|
]
|
|
647
626
|
`);
|
|
@@ -678,14 +657,7 @@ describe('alog', () => {
|
|
|
678
657
|
]
|
|
679
658
|
},
|
|
680
659
|
"patchOptions": {
|
|
681
|
-
"reloadVersion": 0
|
|
682
|
-
"pipelineOptions": {
|
|
683
|
-
"pipelineID": "pipelineID",
|
|
684
|
-
"needTimestamps": true,
|
|
685
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
686
|
-
"dsl": "reactLynx",
|
|
687
|
-
"stage": "hydrate"
|
|
688
|
-
}
|
|
660
|
+
"reloadVersion": 0
|
|
689
661
|
}
|
|
690
662
|
}",
|
|
691
663
|
],
|
|
@@ -693,7 +665,7 @@ describe('alog', () => {
|
|
|
693
665
|
"[ReactLynxDebug] FiberElement API call #32: __SetAttribute(#text#6, "text", 0)",
|
|
694
666
|
],
|
|
695
667
|
[
|
|
696
|
-
"[ReactLynxDebug] FiberElement API call #33: __FlushElementTree(PAGE#0, {
|
|
668
|
+
"[ReactLynxDebug] FiberElement API call #33: __FlushElementTree(PAGE#0, {})",
|
|
697
669
|
],
|
|
698
670
|
]
|
|
699
671
|
`);
|
|
@@ -738,14 +710,7 @@ describe('alog', () => {
|
|
|
738
710
|
]
|
|
739
711
|
},
|
|
740
712
|
"patchOptions": {
|
|
741
|
-
"reloadVersion": 0
|
|
742
|
-
"pipelineOptions": {
|
|
743
|
-
"pipelineID": "pipelineID",
|
|
744
|
-
"needTimestamps": true,
|
|
745
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
746
|
-
"dsl": "reactLynx",
|
|
747
|
-
"stage": "hydrate"
|
|
748
|
-
}
|
|
713
|
+
"reloadVersion": 0
|
|
749
714
|
}
|
|
750
715
|
}",
|
|
751
716
|
],
|
|
@@ -753,7 +718,7 @@ describe('alog', () => {
|
|
|
753
718
|
"[ReactLynxDebug] FiberElement API call #34: __SetAttribute(#text#6, "text", 1)",
|
|
754
719
|
],
|
|
755
720
|
[
|
|
756
|
-
"[ReactLynxDebug] FiberElement API call #35: __FlushElementTree(PAGE#0, {
|
|
721
|
+
"[ReactLynxDebug] FiberElement API call #35: __FlushElementTree(PAGE#0, {})",
|
|
757
722
|
],
|
|
758
723
|
]
|
|
759
724
|
`);
|
|
@@ -790,14 +755,7 @@ describe('alog', () => {
|
|
|
790
755
|
]
|
|
791
756
|
},
|
|
792
757
|
"patchOptions": {
|
|
793
|
-
"reloadVersion": 0
|
|
794
|
-
"pipelineOptions": {
|
|
795
|
-
"pipelineID": "pipelineID",
|
|
796
|
-
"needTimestamps": true,
|
|
797
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
798
|
-
"dsl": "reactLynx",
|
|
799
|
-
"stage": "hydrate"
|
|
800
|
-
}
|
|
758
|
+
"reloadVersion": 0
|
|
801
759
|
}
|
|
802
760
|
}",
|
|
803
761
|
],
|
|
@@ -805,7 +763,7 @@ describe('alog', () => {
|
|
|
805
763
|
"[ReactLynxDebug] FiberElement API call #34: __SetAttribute(#text#6, "text", 1)",
|
|
806
764
|
],
|
|
807
765
|
[
|
|
808
|
-
"[ReactLynxDebug] FiberElement API call #35: __FlushElementTree(PAGE#0, {
|
|
766
|
+
"[ReactLynxDebug] FiberElement API call #35: __FlushElementTree(PAGE#0, {})",
|
|
809
767
|
],
|
|
810
768
|
]
|
|
811
769
|
`);
|
|
@@ -120,13 +120,6 @@ test('state change will cause re-render', async () => {
|
|
|
120
120
|
{
|
|
121
121
|
"data": "{"patchList":[{"id":3,"snapshotPatch":[2,-1,2,0,"__snapshot_f46c5_test_2",3,0,null,4,3,4,0,"Hello World",1,3,4,null,0,1,-1,3,null,0]}]}",
|
|
122
122
|
"patchOptions": {
|
|
123
|
-
"pipelineOptions": {
|
|
124
|
-
"dsl": "reactLynx",
|
|
125
|
-
"needTimestamps": true,
|
|
126
|
-
"pipelineID": "pipelineID",
|
|
127
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
128
|
-
"stage": "hydrate",
|
|
129
|
-
},
|
|
130
123
|
"reloadVersion": 0,
|
|
131
124
|
},
|
|
132
125
|
},
|
|
@@ -97,13 +97,6 @@ test('setState generates insertBefore operation', async () => {
|
|
|
97
97
|
{
|
|
98
98
|
"data": "{"patchList":[{"id":3,"snapshotPatch":[1,-2,-7,-5,0]}]}",
|
|
99
99
|
"patchOptions": {
|
|
100
|
-
"pipelineOptions": {
|
|
101
|
-
"dsl": "reactLynx",
|
|
102
|
-
"needTimestamps": true,
|
|
103
|
-
"pipelineID": "pipelineID",
|
|
104
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
105
|
-
"stage": "hydrate",
|
|
106
|
-
},
|
|
107
100
|
"reloadVersion": 0,
|
|
108
101
|
},
|
|
109
102
|
},
|
|
@@ -268,13 +261,6 @@ test('setState triggered renderComponent should have correct slotIndex', async (
|
|
|
268
261
|
{
|
|
269
262
|
"data": "{"patchList":[{"id":3,"snapshotPatch":[2,-2,-4,0,"__snapshot_289e0_test_5",6,0,null,7,3,7,0,1,1,6,7,null,0,1,-2,6,null,1]}]}",
|
|
270
263
|
"patchOptions": {
|
|
271
|
-
"pipelineOptions": {
|
|
272
|
-
"dsl": "reactLynx",
|
|
273
|
-
"needTimestamps": true,
|
|
274
|
-
"pipelineID": "pipelineID",
|
|
275
|
-
"pipelineOrigin": "reactLynxHydrate",
|
|
276
|
-
"stage": "hydrate",
|
|
277
|
-
},
|
|
278
264
|
"reloadVersion": 0,
|
|
279
265
|
},
|
|
280
266
|
},
|
|
@@ -674,4 +674,53 @@ describe('worklet', () => {
|
|
|
674
674
|
|
|
675
675
|
expect(globalThis.classCaptureCb).toHaveBeenCalledWith(42);
|
|
676
676
|
});
|
|
677
|
+
|
|
678
|
+
it('renders and invokes worklets with nullish optional member captures', () => {
|
|
679
|
+
globalThis.optionalCaptureCb = vi.fn();
|
|
680
|
+
|
|
681
|
+
const start = () => {
|
|
682
|
+
'main thread';
|
|
683
|
+
globalThis.optionalCaptureCb('started');
|
|
684
|
+
};
|
|
685
|
+
const nestedStart = () => {
|
|
686
|
+
'main thread';
|
|
687
|
+
globalThis.optionalCaptureCb('nested-started');
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
const Comp = ({ enabled, handlers }) => {
|
|
691
|
+
return (
|
|
692
|
+
<view
|
|
693
|
+
main-thread:bindtap={() => {
|
|
694
|
+
'main thread';
|
|
695
|
+
if (enabled && handlers?.start) handlers.start();
|
|
696
|
+
if (enabled && handlers?.nested?.start) handlers.nested.start();
|
|
697
|
+
}}
|
|
698
|
+
/>
|
|
699
|
+
);
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
const { container, rerender } = render(
|
|
703
|
+
<Comp enabled={false} handlers={null} />,
|
|
704
|
+
{
|
|
705
|
+
enableMainThread: true,
|
|
706
|
+
enableBackgroundThread: true,
|
|
707
|
+
},
|
|
708
|
+
);
|
|
709
|
+
fireEvent.tap(container.firstChild);
|
|
710
|
+
expect(globalThis.optionalCaptureCb).not.toHaveBeenCalled();
|
|
711
|
+
|
|
712
|
+
rerender(<Comp enabled={true} handlers={undefined} />);
|
|
713
|
+
fireEvent.tap(container.firstChild);
|
|
714
|
+
expect(globalThis.optionalCaptureCb).not.toHaveBeenCalled();
|
|
715
|
+
|
|
716
|
+
rerender(<Comp enabled={true} handlers={{ start, nested: null }} />);
|
|
717
|
+
fireEvent.tap(container.firstChild);
|
|
718
|
+
expect(globalThis.optionalCaptureCb).toHaveBeenCalledTimes(1);
|
|
719
|
+
expect(globalThis.optionalCaptureCb).toHaveBeenLastCalledWith('started');
|
|
720
|
+
|
|
721
|
+
rerender(<Comp enabled={true} handlers={{ start, nested: { start: nestedStart } }} />);
|
|
722
|
+
fireEvent.tap(container.firstChild);
|
|
723
|
+
expect(globalThis.optionalCaptureCb).toHaveBeenCalledTimes(3);
|
|
724
|
+
expect(globalThis.optionalCaptureCb).toHaveBeenLastCalledWith('nested-started');
|
|
725
|
+
});
|
|
677
726
|
});
|