Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b109ea2
feat(react): optimize the number and depth of snapshot
hzy Sep 18, 2025
f445c76
feat: make test pass
upupming Oct 9, 2025
acc8e45
fix: test case of hydrate and list
upupming Oct 10, 2025
b7eba1d
fix: slotIndex for setupDocument
upupming Oct 10, 2025
ca7232d
fix: renderComponent slotIndex
upupming Oct 10, 2025
49cd30b
fix: slotIndex of RLTL
upupming Oct 10, 2025
ce28aff
Merge remote-tracking branch 'gh/main' into p/hzy/opt-slot_0
upupming Oct 10, 2025
6b05166
feat: update cargo snapshot
upupming Oct 10, 2025
c57f3bf
chore: dprint format
upupming Oct 10, 2025
840b0e4
Merge remote-tracking branch 'gh/main' into p/hzy/opt-slot_0
upupming Oct 10, 2025
6367bdb
chore: clean up console.log
upupming Oct 10, 2025
11a436c
chore: update turbo.json
upupming Oct 10, 2025
8a662b7
feat: add insertBefore operation example
upupming Oct 11, 2025
abe20ac
feat: update test cases
upupming Oct 11, 2025
f8e0e5f
Merge remote-tracking branch 'gh/main' into p/hzy/opt-slot_0
upupming Oct 11, 2025
4974e77
feat: cover test for legacy DynamicPartType
upupming Oct 11, 2025
cd52ab1
feat: remove wrapper introducted in #1455
upupming Oct 11, 2025
326e0d8
feat: cover test for slotIndex of non text `children`
upupming Oct 11, 2025
f964aed
chore: update RLTL snapshot
upupming Oct 11, 2025
d738aa0
Merge remote-tracking branch 'gh/main' into p/hzy/opt-slot_0
upupming Oct 16, 2025
4d40ca1
Revert "feat: remove wrapper introducted in #1455"
upupming Oct 16, 2025
8b59089
feat: keep the lynx suspense from #1455
upupming Oct 16, 2025
7bfb52d
feat: call insertBefore when slotIndex changes
upupming Nov 10, 2025
e83bd78
Merge remote-tracking branch 'gh/main' into p/hzy/opt-slot_0
upupming Nov 10, 2025
a4b4aaa
fix: typo
upupming Nov 10, 2025
09f94fc
feat: remove __slotIndex of document.ts
upupming Nov 11, 2025
fe8ea2b
Merge origin/main into pr-1764
upupming Mar 19, 2026
b454c32
Fix react runtime test regressions after merge
upupming Mar 19, 2026
fbbb35a
Update transform and hot refresh snapshots for slot v2
upupming Mar 19, 2026
334ede9
Merge origin/main into pr-1764 with pkg.pr.new preact
upupming Mar 19, 2026
974e058
Fix react runtime test regressions after merge
upupming Mar 19, 2026
16b1b67
Use pkg.pr.new internal-preact preview
upupming Mar 19, 2026
d5f52df
Update transform and hot refresh snapshots for slot v2
upupming Mar 19, 2026
0105973
test(react-runtime): adapt runtime tests for preview preact
upupming Mar 19, 2026
10169cc
test(react-runtime): cover profile and list hydrate moves
upupming Mar 19, 2026
cc1c68c
Merge remote PR branch into remerge branch before push
upupming Mar 19, 2026
22c4a7e
chore(lockfile): dedupe pnpm lockfile
upupming Mar 19, 2026
e676f2c
Merge remote-tracking branch 'origin/main' into p/hzy/opt-slot_0
upupming Apr 16, 2026
c165c4c
fix: snapshot
upupming Apr 16, 2026
48579db
feat: reduce fragment on single slot child
upupming Apr 16, 2026
9c89ba9
feat: eliminate multi-slot Fragment via flatten + slot-aware reconcile
upupming Apr 17, 2026
2e49b89
feat: simplify slotMap
upupming Apr 17, 2026
11ce6bb
Revert "feat: simplify slotMap"
upupming Apr 17, 2026
17ed3cf
Revert "feat: eliminate multi-slot Fragment via flatten + slot-aware …
upupming Apr 17, 2026
9ed7712
chore: upgrade preact
upupming Apr 20, 2026
78946fc
fix: snapshot
upupming Apr 20, 2026
e9b386d
fix: test cases
upupming Apr 20, 2026
2ceaf27
Merge remote-tracking branch 'origin/main' into p/hzy/opt-slot_0
upupming Apr 20, 2026
f18bbf3
fix: remove unused test
upupming Apr 20, 2026
6bd678d
feat: reduce empty text vnode and dom
upupming Apr 20, 2026
60b047a
Merge remote-tracking branch 'origin/main' into p/hzy/opt-slot_0
upupming Apr 20, 2026
cfb0a4b
fix: wrapper in suspense should always use $0
upupming Apr 20, 2026
159280d
Revert "fix: remove unused test"
upupming Apr 20, 2026
afd2d6a
chore: changeset
upupming Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/react-transform.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
applyTo: "packages/react/transform/**/*"
---

When validating SWC transform snapshot changes, update the Rust fixtures with `UPDATE=1 cargo test -p swc_plugin_snapshot` and `UPDATE=1 cargo test -p swc_plugin_list --features napi` so the stored snapshots match the current transform output.
86 changes: 47 additions & 39 deletions packages/react/runtime/__test__/basic.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ describe('insertBefore', () => {

const b = new SnapshotInstance(snapshot2);
const c = new SnapshotInstance(snapshot2);
b.__slotIndex = 0;
c.__slotIndex = 1;

a.insertBefore(b);
a.insertBefore(c);
Expand All @@ -114,23 +116,27 @@ describe('insertBefore', () => {
/>
</text>
<text>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
<wrapper>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
</wrapper>
<raw-text
text="!!!"
/>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
<wrapper>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
</wrapper>
</text>
</view>
`);
Expand All @@ -155,6 +161,9 @@ describe('insertBefore', () => {
const a = new SnapshotInstance(snapshot1);
const b = new SnapshotInstance(snapshot2);
const c = new SnapshotInstance(snapshot2);
b.__slotIndex = 0;
c.__slotIndex = 1;

a.insertBefore(b);
a.insertBefore(c);

Expand All @@ -168,23 +177,27 @@ describe('insertBefore', () => {
/>
</text>
<text>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
<wrapper>
Comment thread
upupming marked this conversation as resolved.
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
</wrapper>
<raw-text
text="!!!"
/>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
<wrapper>
<view>
<text>
<raw-text
text="Hello World"
/>
</text>
</view>
</wrapper>
</text>
</view>
`);
Expand Down Expand Up @@ -388,11 +401,7 @@ describe('dynamic key in snapshot', () => {

expect(a.__element_root).toMatchInlineSnapshot(`
<view>
<view
class="foo"
>
<wrapper />
</view>
<wrapper />
</view>
`);
});
Expand All @@ -418,7 +427,10 @@ describe('dynamic key in snapshot', () => {
<view
class="foo"
>
<wrapper />
<view>
<view />
<view />
</view>
</view>
`);
});
Expand Down Expand Up @@ -449,11 +461,7 @@ describe('dynamic key in snapshot', () => {
/>
<wrapper />
</text>
<view
class="foo"
>
<wrapper />
</view>
<wrapper />
</view>
`);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/react/runtime/__test__/debug/formatPatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('formatPatch', () => {
1,
2,
undefined,
0,
SnapshotOperation.RemoveChild,
1,
2,
Expand All @@ -32,7 +33,7 @@ describe('formatPatch', () => {
const formatted = prettyFormatSnapshotPatch(snapshotPatch);
expect(formatted).toEqual([
{ op: 'CreateElement', type: 'span', id: 2 },
{ op: 'InsertBefore', parentId: 1, childId: 2, beforeId: undefined },
{ op: 'InsertBefore', parentId: 1, childId: 2, beforeId: undefined, slotIndex: 0 },
{ op: 'RemoveChild', parentId: 1, childId: 2 },
{ op: 'SetAttribute', id: 2, dynamicPartIndex: 1, value: 'disabled' },
{ op: 'SetAttributes', id: 2, values: { hidden: true } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('delayedLifecycleEvents', () => {
"rLynxFirstScreen",
{
"jsReadyEventIdSwap": {},
"root": "{"id":-1,"type":"root","children":[{"id":-2,"type":"__snapshot_a94a8_test_1"}]}",
"root": "{"id":-1,"type":"root","children":[{"id":-2,"type":"__snapshot_a94a8_test_1","__slotIndex":0}]}",
},
],
],
Expand All @@ -44,7 +44,7 @@ describe('delayedLifecycleEvents', () => {
"rLynxFirstScreen",
{
"jsReadyEventIdSwap": {},
"root": "{"id":-1,"type":"root","children":[{"id":-2,"type":"__snapshot_a94a8_test_1"}]}",
"root": "{"id":-1,"type":"root","children":[{"id":-2,"type":"__snapshot_a94a8_test_1","__slotIndex":0}]}",
},
],
]
Expand Down
9 changes: 9 additions & 0 deletions packages/react/runtime/__test__/hydrate.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ describe('dual-runtime hydrate', () => {
3,
7,
undefined,
undefined,
0,
"__snapshot_a94a8_test_4",
8,
1,
3,
8,
undefined,
undefined,
0,
"__snapshot_a94a8_test_2",
9,
Expand All @@ -148,10 +150,12 @@ describe('dual-runtime hydrate', () => {
3,
9,
undefined,
undefined,
1,
-1,
3,
-3,
undefined,
0,
"__snapshot_a94a8_test_2",
6,
Expand All @@ -164,6 +168,7 @@ describe('dual-runtime hydrate', () => {
-1,
6,
undefined,
undefined,
]
`);
backgroundSnapshotInstanceManager.values.forEach((v, k) => {
Expand Down Expand Up @@ -231,6 +236,7 @@ describe('dual-runtime hydrate', () => {
-1,
-3,
-5,
undefined,
]
`);
});
Expand All @@ -253,13 +259,15 @@ describe('dual-runtime hydrate', () => {
-1,
2,
undefined,
undefined,
0,
"__snapshot_a94a8_test_3",
3,
1,
-1,
3,
undefined,
undefined,
]
`);
});
Expand Down Expand Up @@ -316,6 +324,7 @@ describe('dual-runtime hydrate - with slot (multi-children)', () => {
-3,
6,
undefined,
undefined,
]
`);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/react/runtime/__test__/lifecycle.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('componentDidMount', () => {
expect(mtCallback[0]).toEqual(LifecycleConstant.patchUpdate);
expect(mtCallback[1]).toMatchInlineSnapshot(`
{
"data": "{"patchList":[{"id":6,"snapshotPatch":[0,"__snapshot_a94a8_test_3",2,0,null,3,3,3,0,1,1,2,3,null,1,1,2,null]}]}",
"data": "{"patchList":[{"id":6,"snapshotPatch":[0,"__snapshot_a94a8_test_3",2,0,null,3,3,3,0,1,1,2,3,null,null,1,1,2,null,null]}]}",
"patchOptions": {
"reloadVersion": 0,
},
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('componentDidMount', () => {
expect(mtCallback[0]).toEqual(LifecycleConstant.patchUpdate);
expect(mtCallback[1]).toMatchInlineSnapshot(`
{
"data": "{"patchList":[{"id":9,"snapshotPatch":[0,"__snapshot_a94a8_test_4",2,0,null,3,3,3,0,1,1,2,3,null,1,1,2,null]}]}",
"data": "{"patchList":[{"id":9,"snapshotPatch":[0,"__snapshot_a94a8_test_4",2,0,null,3,3,3,0,1,1,2,3,null,null,1,1,2,null,null]}]}",
"patchOptions": {
"reloadVersion": 0,
},
Expand Down Expand Up @@ -559,7 +559,7 @@ describe('useState', () => {
await waitSchedule();
expect(lynx.getNativeApp().callLepusMethod).toHaveBeenCalledTimes(1);
expect(lynx.getNativeApp().callLepusMethod.mock.calls[0][1].data).toMatchInlineSnapshot(
`"{"patchList":[{"id":27,"snapshotPatch":[0,"__snapshot_a94a8_test_15",2,4,2,[false,{"str":"str"}],1,-1,2,null]}]}"`,
`"{"patchList":[{"id":27,"snapshotPatch":[0,"__snapshot_a94a8_test_15",2,4,2,[false,{"str":"str"}],1,-1,2,null,null]}]}"`,
);
}
});
Expand Down
16 changes: 8 additions & 8 deletions packages/react/runtime/__test__/lifecycle/reload.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ describe('reload', () => {
[
"rLynxFirstScreen",
{
"root": "{"id":-9,"type":"root","children":[{"id":-13,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-10,"type":"__snapshot_a94a8_test_3","children":[{"id":-15,"type":null,"values":["Enjoy"]}]},{"id":-11,"type":"__snapshot_a94a8_test_4","children":[{"id":-16,"type":null,"values":["World"]}]},{"id":-12,"type":"wrapper","children":[{"id":-14,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}]}]}]}]}",
"root": "{"id":-9,"type":"root","children":[{"id":-13,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-10,"type":"__snapshot_a94a8_test_3","children":[{"id":-15,"type":null,"values":["Enjoy"],"__slotIndex":0}],"__slotIndex":0},{"id":-11,"type":"__snapshot_a94a8_test_4","children":[{"id":-16,"type":null,"values":["World"],"__slotIndex":0}],"__slotIndex":0},{"id":-12,"type":"wrapper","children":[{"id":-14,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
],
Expand Down Expand Up @@ -723,7 +723,7 @@ describe('reload', () => {
[
"rLynxFirstScreen",
{
"root": "{"id":-9,"type":"root","children":[{"id":-15,"type":"__snapshot_a94a8_test_5","children":[{"id":-13,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-10,"type":"__snapshot_a94a8_test_3","children":[{"id":-16,"type":null,"values":["Enjoy"]}]},{"id":-11,"type":"__snapshot_a94a8_test_4","children":[{"id":-17,"type":null,"values":["World"]}]},{"id":-12,"type":"wrapper","children":[{"id":-14,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}]}]}]}]}]}",
"root": "{"id":-9,"type":"root","children":[{"id":-15,"type":"__snapshot_a94a8_test_5","children":[{"id":-13,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-10,"type":"__snapshot_a94a8_test_3","children":[{"id":-16,"type":null,"values":["Enjoy"],"__slotIndex":0}],"__slotIndex":0},{"id":-11,"type":"__snapshot_a94a8_test_4","children":[{"id":-17,"type":null,"values":["World"],"__slotIndex":0}],"__slotIndex":0},{"id":-12,"type":"wrapper","children":[{"id":-14,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
],
Expand Down Expand Up @@ -1314,15 +1314,15 @@ describe('firstScreenSyncTiming - jsReady', () => {
"-8": -16,
"-9": -17,
},
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-18,"type":"__snapshot_a94a8_test_3","children":[{"id":-23,"type":null,"values":["Hello 2"]}]},{"id":-19,"type":"__snapshot_a94a8_test_4","children":[{"id":-24,"type":null,"values":["World"]}]},{"id":-20,"type":"wrapper","children":[{"id":-22,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}]}]}]}]}",
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-18,"type":"__snapshot_a94a8_test_3","children":[{"id":-23,"type":null,"values":["Hello 2"],"__slotIndex":0}],"__slotIndex":0},{"id":-19,"type":"__snapshot_a94a8_test_4","children":[{"id":-24,"type":null,"values":["World"],"__slotIndex":0}],"__slotIndex":0},{"id":-20,"type":"wrapper","children":[{"id":-22,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
]
`);
expect(lynx.getNativeApp().callLepusMethod).toHaveBeenCalledTimes(1);
expect(lynx.getNativeApp().callLepusMethod.mock.calls[0][1]).toMatchInlineSnapshot(`
{
"data": "{"patchList":[{"snapshotPatch":[2,-17,-21,0,"__snapshot_a94a8_test_5",2,0,"__snapshot_a94a8_test_2",3,4,3,[{"dataX":"WorldX"}],0,"__snapshot_a94a8_test_3",4,0,null,5,4,5,["Hello 2"],1,4,5,null,1,3,4,null,0,"__snapshot_a94a8_test_4",6,0,null,7,4,7,["World"],1,6,7,null,1,3,6,null,0,"wrapper",8,0,"__snapshot_a94a8_test_1",9,4,9,[{"attr":{"dataX":"WorldX"}}],1,8,9,null,1,3,8,null,1,2,3,null,1,-17,2,null],"id":21}]}",
"data": "{"patchList":[{"snapshotPatch":[2,-17,-21,0,"__snapshot_a94a8_test_5",2,0,"__snapshot_a94a8_test_2",3,4,3,[{"dataX":"WorldX"}],0,"__snapshot_a94a8_test_3",4,0,null,5,4,5,["Hello 2"],1,4,5,null,null,1,3,4,null,null,0,"__snapshot_a94a8_test_4",6,0,null,7,4,7,["World"],1,6,7,null,null,1,3,6,null,null,0,"wrapper",8,0,"__snapshot_a94a8_test_1",9,4,9,[{"attr":{"dataX":"WorldX"}}],1,8,9,null,null,1,3,8,null,null,1,2,3,null,null,1,-17,2,null,null],"id":21}]}",
"patchOptions": {
"isHydration": true,
"pipelineOptions": {
Expand Down Expand Up @@ -1517,7 +1517,7 @@ describe('firstScreenSyncTiming - jsReady', () => {
"-5": -13,
"-9": -17,
},
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_7","children":[{"id":-18,"type":"__snapshot_a94a8_test_8","values":[{"item-key":0}],"children":[{"id":-22,"type":"__snapshot_a94a8_test_6","values":["a"]}]},{"id":-19,"type":"__snapshot_a94a8_test_8","values":[{"item-key":1}],"children":[{"id":-23,"type":"__snapshot_a94a8_test_6","values":["b"]}]},{"id":-20,"type":"__snapshot_a94a8_test_8","values":[{"item-key":2}],"children":[{"id":-24,"type":"__snapshot_a94a8_test_6","values":["c"]}]}]}]}",
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_7","children":[{"id":-18,"type":"__snapshot_a94a8_test_8","values":[{"item-key":0}],"children":[{"id":-22,"type":"__snapshot_a94a8_test_6","values":["a"],"__slotIndex":0}],"__slotIndex":0},{"id":-19,"type":"__snapshot_a94a8_test_8","values":[{"item-key":1}],"children":[{"id":-23,"type":"__snapshot_a94a8_test_6","values":["b"],"__slotIndex":0}],"__slotIndex":0},{"id":-20,"type":"__snapshot_a94a8_test_8","values":[{"item-key":2}],"children":[{"id":-24,"type":"__snapshot_a94a8_test_6","values":["c"],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
]
Expand Down Expand Up @@ -1681,7 +1681,7 @@ describe('firstScreenSyncTiming - jsReady', () => {
"-2": -10,
"-6": -14,
},
"root": "{"id":-10,"type":"root","children":[{"id":-14,"type":"__snapshot_a94a8_test_9","children":[{"id":-11,"type":"__snapshot_a94a8_test_10","values":[{"item-key":0}],"children":[{"id":-15,"type":"__snapshot_a94a8_test_6","values":["a"]}]},{"id":-12,"type":"__snapshot_a94a8_test_10","values":[{"item-key":1}],"children":[{"id":-16,"type":"__snapshot_a94a8_test_6","values":["b"]}]},{"id":-13,"type":"__snapshot_a94a8_test_10","values":[{"item-key":2}],"children":[{"id":-17,"type":"__snapshot_a94a8_test_6","values":["c"]}]}]}]}",
"root": "{"id":-10,"type":"root","children":[{"id":-14,"type":"__snapshot_a94a8_test_9","children":[{"id":-11,"type":"__snapshot_a94a8_test_10","values":[{"item-key":0}],"children":[{"id":-15,"type":"__snapshot_a94a8_test_6","values":["a"],"__slotIndex":0}],"__slotIndex":0},{"id":-12,"type":"__snapshot_a94a8_test_10","values":[{"item-key":1}],"children":[{"id":-16,"type":"__snapshot_a94a8_test_6","values":["b"],"__slotIndex":0}],"__slotIndex":0},{"id":-13,"type":"__snapshot_a94a8_test_10","values":[{"item-key":2}],"children":[{"id":-17,"type":"__snapshot_a94a8_test_6","values":["c"],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
]
Expand Down Expand Up @@ -1874,15 +1874,15 @@ describe('firstScreenSyncTiming - jsReady', () => {
"rLynxFirstScreen",
{
"jsReadyEventIdSwap": {},
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-18,"type":"__snapshot_a94a8_test_3","children":[{"id":-23,"type":null,"values":["Hello 2"]}]},{"id":-19,"type":"__snapshot_a94a8_test_4","children":[{"id":-24,"type":null,"values":["World"]}]},{"id":-20,"type":"wrapper","children":[{"id":-22,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}]}]}]}]}",
"root": "{"id":-17,"type":"root","children":[{"id":-21,"type":"__snapshot_a94a8_test_2","values":[{"dataX":"WorldX"}],"children":[{"id":-18,"type":"__snapshot_a94a8_test_3","children":[{"id":-23,"type":null,"values":["Hello 2"],"__slotIndex":0}],"__slotIndex":0},{"id":-19,"type":"__snapshot_a94a8_test_4","children":[{"id":-24,"type":null,"values":["World"],"__slotIndex":0}],"__slotIndex":0},{"id":-20,"type":"wrapper","children":[{"id":-22,"type":"__snapshot_a94a8_test_1","values":[{"attr":{"dataX":"WorldX"}}],"__slotIndex":0}],"__slotIndex":0}],"__slotIndex":0}]}",
},
],
]
`);
expect(lynx.getNativeApp().callLepusMethod).toHaveBeenCalledTimes(1);
expect(lynx.getNativeApp().callLepusMethod.mock.calls[0][1]).toMatchInlineSnapshot(`
{
"data": "{"patchList":[{"snapshotPatch":[2,-17,-21,0,"__snapshot_a94a8_test_5",2,0,"__snapshot_a94a8_test_2",3,4,3,[{"dataX":"WorldX"}],0,"__snapshot_a94a8_test_3",4,0,null,5,4,5,["Hello 2"],1,4,5,null,1,3,4,null,0,"__snapshot_a94a8_test_4",6,0,null,7,4,7,["World"],1,6,7,null,1,3,6,null,0,"wrapper",8,0,"__snapshot_a94a8_test_1",9,4,9,[{"attr":{"dataX":"WorldX"}}],1,8,9,null,1,3,8,null,1,2,3,null,1,-17,2,null],"id":27}]}",
"data": "{"patchList":[{"snapshotPatch":[2,-17,-21,0,"__snapshot_a94a8_test_5",2,0,"__snapshot_a94a8_test_2",3,4,3,[{"dataX":"WorldX"}],0,"__snapshot_a94a8_test_3",4,0,null,5,4,5,["Hello 2"],1,4,5,null,null,1,3,4,null,null,0,"__snapshot_a94a8_test_4",6,0,null,7,4,7,["World"],1,6,7,null,null,1,3,6,null,null,0,"wrapper",8,0,"__snapshot_a94a8_test_1",9,4,9,[{"attr":{"dataX":"WorldX"}}],1,8,9,null,null,1,3,8,null,null,1,2,3,null,null,1,-17,2,null,null],"id":27}]}",
"patchOptions": {
"isHydration": true,
"pipelineOptions": {
Expand Down
4 changes: 4 additions & 0 deletions packages/react/runtime/__test__/lynx/suspense.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ describe('suspense', () => {
"childId": 3,
"op": "InsertBefore",
"parentId": 2,
"slotIndex": 0,
},
{
"beforeId": null,
"childId": 2,
"op": "InsertBefore",
"parentId": -1,
"slotIndex": 0,
},
{
"childId": -3,
Expand All @@ -295,12 +297,14 @@ describe('suspense', () => {
"childId": 7,
"op": "InsertBefore",
"parentId": 3,
"slotIndex": 0,
},
{
"beforeId": null,
"childId": 2,
"op": "InsertBefore",
"parentId": -1,
"slotIndex": 0,
},
]
`);
Expand Down
Loading
Loading