[Components]: Fix race condition in tree reload handling#1393
Conversation
🦋 Changeset detectedLatest commit: c6d66d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Looks like we need to wait for tree to actually reload (nodeLoader/modelSource) to change? d2c7082 |
Seems to fix the issue, can you push that commit here? |
Pushed |
There was a problem hiding this comment.
Pull request overview
This PR stabilizes the Tree update full-stack test under React 19 by ensuring assertions wait for the hook to produce a new nodeLoader before verifying the updated tree, accounting for changed effect scheduling.
Changes:
- Track the last observed
nodeLoaderand wait for it to change before asserting the updated hierarchy. - Update the verification loop to advance the tracked
nodeLoaderafter each successful update.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Can we have more details on this?
|
A Flaky test (detects a change in rule condition) appeared when we switched to react 19, because of slight differences how react runs effects.From my understanding the test fails because setting a variable trigger a reload, which produces a new modelSource React then re-runs the useEffect - removing the old listener and adding a new one. If the next variable change fires in the gap between removal and re-subscription, the event is lost and the test hangs.Underlying issue was race condition in how tree reload is handled. It was possible for change event to be raised between listener is removed and added back. This meant that some events were missed and tree was not reloading.