Skip to content

Commit f8d9db4

Browse files
committed
Don't mutate while diffing
1 parent a6c886c commit f8d9db4

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

packages/react-devtools-shared/src/__tests__/storeComponentFilters-test.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -910,14 +910,21 @@ describe('Store component filters', () => {
910910

911911
expect(store).toMatchInlineSnapshot(`
912912
[root]
913-
▾ <Activity name="/">
914-
▾ <Suspense>
915-
<h1>
916-
▾ <main>
917-
▾ <Layout>
918-
<Activity name="/blog">
913+
▾ <Root>
914+
▾ <Activity name="/">
915+
▾ <Suspense>
916+
<h1>
917+
▾ <main>
918+
▾ <Layout>
919+
▾ <Activity name="/blog">
920+
<h2>
921+
▾ <section>
922+
▾ <Page>
923+
▾ <Suspense>
924+
<div>
919925
[suspense-root] rects={[{x:1,y:2,width:4,height:1}, {x:1,y:2,width:13,height:1}]}
920-
<Suspense name="Unknown" rects={[{x:1,y:2,width:4,height:1}, {x:1,y:2,width:13,height:1}]}>
926+
<Suspense name="Root" rects={[{x:1,y:2,width:4,height:1}, {x:1,y:2,width:13,height:1}]}>
927+
<Suspense name="Page" rects={[{x:1,y:2,width:9,height:1}]}>
921928
`);
922929
});
923930
});

packages/react-devtools-shared/src/backend/fiber/renderer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,8 +1492,8 @@ export function attach(
14921492
isInActivitySlice = false;
14931493
} else {
14941494
// We're not filtering by activity slice after all.
1495-
// TODO: This is not sent to the frontend.
1496-
componentFilter.isEnabled = false;
1495+
// Don't mark the filter as disabled here.
1496+
// Otherwise updateComponentFilters() will think no enabled filter was changed.
14971497
}
14981498
break;
14991499
default:
@@ -1546,6 +1546,7 @@ export function attach(
15461546
const filter = componentFilters[i];
15471547
if (filter.type === ComponentFilterActivitySlice && filter.isEnabled) {
15481548
const instance = idToDevToolsInstanceMap.get(filter.activityID);
1549+
console.log({filter, instance});
15491550
if (instance !== undefined && instance.kind === FIBER_INSTANCE) {
15501551
nextActivitySlice = instance.data;
15511552
}

0 commit comments

Comments
 (0)