Skip to content

Commit 3e3f8ea

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
enable enableEagerAlternateStateNodeCleanup in tests (facebook#51291)
Summary: Pull Request resolved: facebook#51291 changelog: [internal] enable enableEagerAlternateStateNodeCleanup in tests and remove workarounds. Reviewed By: rubennorte Differential Revision: D74643973 fbshipit-source-id: 00f9a6b36546fdea246b587e0e716c7aa76c6bbc
1 parent 76ed662 commit 3e3f8ea

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

packages/react-native-fantom/runtime/mocks/ReactNativeInternalFeatureFlags.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@
99
* @oncall react_native
1010
*/
1111

12-
module.exports = {};
12+
module.exports = {
13+
// When enableEagerAlternateStateNodeCleanup is enabled, alternate.stateNode is proactively
14+
// pointed towards finishedWork's stateNode, releasing resources sooner.
15+
// With enableEagerAlternateStateNodeCleanup enabled, we can remove workarounds in tests
16+
// and have predictable memory model.
17+
// See https://github.com/facebook/react/pull/33161 for details.
18+
enableEagerAlternateStateNodeCleanup: true,
19+
};

packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeReferenceCounter-itest.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ test('shadow node expires when replaced by null', () => {
166166
root.render(<View>{null}</View>);
167167
});
168168

169-
// TODO (T223254666): Delete this and figure out why test fails.
170-
Fantom.runTask(() => {
171-
root.render(<View>{null}</View>);
172-
});
173-
174169
expect(getReferenceCount()).toBe(0);
175170
});
176171

@@ -197,14 +192,5 @@ test('shadow node expires when replaced by another view', () => {
197192
);
198193
});
199194

200-
// TODO (T223254666): Delete this and figure out why test fails.
201-
Fantom.runTask(() => {
202-
root.render(
203-
<View>
204-
<View key="b" />
205-
</View>,
206-
);
207-
});
208-
209195
expect(getReferenceCount()).toBe(0);
210196
});

packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,11 +879,6 @@ describe('IntersectionObserver', () => {
879879
root.render(<Observe />);
880880
});
881881

882-
// TODO (T223254666): Delete this and figure out why test fails.
883-
Fantom.runTask(() => {
884-
root.render(<Observe />);
885-
});
886-
887882
expect(getReferenceCount()).toBe(0);
888883
});
889884

packages/react-native/src/private/webapis/mutationobserver/__tests__/MutationObserver-itest.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,6 @@ const nativeUnobserveAll = nullthrows(NativeMutationObserver?.unobserveAll);
858858
root.render(<View style={{width: 1}} />);
859859
});
860860

861-
// This forces swapping the alternate tree in the reconciler
862-
Fantom.runTask(() => {
863-
// Set style to force a state update
864-
root.render(<View style={{width: 2}} />);
865-
});
866-
867861
expect(getReferenceCount()).toBe(0);
868862

869863
observer.disconnect();

0 commit comments

Comments
 (0)