Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions .changeset/bump-internal-preact-10-29-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lynx-js/react": patch
---

Bump `@lynx-js/internal-preact` from `10.28.4-dfff9aa` to `10.29.1-20260423030218-e604bd5`.

Includes a diff-time fix that baselines `__slotIndex` on freshly-created DOM nodes, preventing `insert()`'s slot-branch from firing spuriously on first placement and avoiding a stale `insertBefore` reference when a sibling detaches mid-diff.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"build": "rslib build"
},
"dependencies": {
"preact": "npm:@lynx-js/internal-preact@10.28.4-dfff9aa"
"preact": "npm:@lynx-js/internal-preact@10.29.1-20260423030218-e604bd5"
},
"devDependencies": {
"@lynx-js/types": "3.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Component, useState } from '@lynx-js/react';

import { fireEvent, render, act } from '..';
import { prettyFormatSnapshotPatch } from '../../../runtime/lib/snapshot/debug/formatPatch';
import { printSnapshotInstanceToString } from '../../../runtime/lib/snapshot/debug/printSnapshot';
import { __root } from '../../../runtime/lib/root';

test('setState changes jsx', async () => {
vi.spyOn(lynxTestingEnv.backgroundThread.lynxCoreInject.tt, 'OnLifecycleEvent');
Expand Down Expand Up @@ -70,10 +72,8 @@ test('setState changes jsx', async () => {
</page>
`);

const view = await findByTestId('view');
fireEvent.tap(view);

{
expect(callLepusMethodCalls.length).toBe(1);
const snapshotPatch = JSON.parse(callLepusMethodCalls[0][1]['data']).patchList[0].snapshotPatch;
const formattedSnapshotPatch = prettyFormatSnapshotPatch(snapshotPatch);
expect(formattedSnapshotPatch).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -161,7 +161,34 @@ test('setState changes jsx', async () => {
`);
}

expect(__root.constructor.name).toMatchInlineSnapshot(`"BackgroundSnapshotInstance"`);
expect(printSnapshotInstanceToString(__root)).toMatchInlineSnapshot(`
"| -1(root): undefined
| 2(__snapshot_c1928_test_4): [null]
| 3(__snapshot_c1928_test_1): undefined
| 4(__snapshot_c1928_test_2): undefined
| 5(__snapshot_c1928_test_2): undefined
| 6(__snapshot_c1928_test_2): undefined
| 7(__snapshot_c1928_test_3): undefined"
`);
lynxTestingEnv.switchToMainThread();
expect(__root.constructor.name).toMatchInlineSnapshot(`"SnapshotInstance"`);
expect(printSnapshotInstanceToString(__root)).toMatchInlineSnapshot(`
"| -1(root): undefined
| 2(__snapshot_c1928_test_4): ["2:0:"]
| 3(__snapshot_c1928_test_1): undefined
| 4(__snapshot_c1928_test_2): undefined
| 5(__snapshot_c1928_test_2): undefined
| 6(__snapshot_c1928_test_2): undefined
| 7(__snapshot_c1928_test_3): undefined"
`);
lynxTestingEnv.switchToBackgroundThread();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

const view = await findByTestId('view');
fireEvent.tap(view);

{
expect(callLepusMethodCalls.length).toBe(2);
const snapshotPatch = JSON.parse(callLepusMethodCalls[1][1]['data']).patchList[0].snapshotPatch;
const formattedSnapshotPatch = prettyFormatSnapshotPatch(snapshotPatch);
expect(formattedSnapshotPatch).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -204,7 +231,7 @@ test('setState changes jsx', async () => {
"type": "__snapshot_c1928_test_1",
},
{
"beforeId": null,
"beforeId": 7,
"childId": 9,
"op": "InsertBefore",
"parentId": 2,
Expand All @@ -216,7 +243,7 @@ test('setState changes jsx', async () => {
"type": "__snapshot_c1928_test_1",
},
{
"beforeId": null,
"beforeId": 7,
"childId": 10,
"op": "InsertBefore",
"parentId": 2,
Expand All @@ -228,7 +255,7 @@ test('setState changes jsx', async () => {
"type": "__snapshot_c1928_test_1",
},
{
"beforeId": null,
"beforeId": 7,
"childId": 11,
"op": "InsertBefore",
"parentId": 2,
Expand Down Expand Up @@ -273,4 +300,27 @@ test('setState changes jsx', async () => {
</view>
</page>
`);

expect(__root.constructor.name).toMatchInlineSnapshot(`"BackgroundSnapshotInstance"`);
expect(printSnapshotInstanceToString(__root)).toMatchInlineSnapshot(`
"| -1(root): undefined
| 2(__snapshot_c1928_test_4): [null]
| 8(__snapshot_c1928_test_2): undefined
| 9(__snapshot_c1928_test_1): undefined
| 10(__snapshot_c1928_test_1): undefined
| 11(__snapshot_c1928_test_1): undefined
| 7(__snapshot_c1928_test_3): undefined"
`);
lynxTestingEnv.switchToMainThread();
expect(__root.constructor.name).toMatchInlineSnapshot(`"SnapshotInstance"`);
expect(printSnapshotInstanceToString(__root)).toMatchInlineSnapshot(`
"| -1(root): undefined
| 2(__snapshot_c1928_test_4): ["2:0:"]
| 8(__snapshot_c1928_test_2): undefined
| 9(__snapshot_c1928_test_1): undefined
| 10(__snapshot_c1928_test_1): undefined
| 11(__snapshot_c1928_test_1): undefined
| 7(__snapshot_c1928_test_3): undefined"
`);
lynxTestingEnv.switchToBackgroundThread();
});
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading