From add2b234b396768b80fac732645355e49a418b44 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Tue, 4 Apr 2023 14:52:50 -0400 Subject: [PATCH] act: Move didScheduleLegacyUpdate to ensureRootIsScheduled `act` uses the `didScheduleLegacyUpdate` field to simulate the behavior of batching in React <17 and below. It's a quirk leftover from a previous implementation, not intentionally designed. This sets `didScheduleLegacyUpdate` every time a legacy root receives an update as opposed to only when the `executionContext` is empty. There's no real reason to do it this way over some other way except that it's how it used to work before #26512 and we should try our best to maintain the existing behavior, quirks and all, since existing tests may have come to accidentally rely on it. This should fix some (though not all) of the internal Meta tests that started failing after #26512 landed.