Skip to content

Conversation

Saadnajmi
Copy link
Collaborator

Summary:

We've had a recurring bug where RCTDevLoadingView stick around blocking the whole app even after it's dismissed. As far as I can tell, this is a race condition where we have multiple devloadingviews at once (each setting and nilling the same self->_window property), which is causing a race condition. Rather than figure out how to make this class only ever show one window or race-safe, for now I will just make sure to dismiss all sheets when hide is called.

While we're at it, a couple of other changes:

  1. Change the type from NSPanel to NSWindow. Panels don't release when closed, which may be causing them to stick around longer than we like
  2. Move the iOS only variable mainWindow into the iOS ifdef, and remove the diffs and diff tag around it.

Test Plan:

Initial testing shows RNTester no longer getting blocked. It could still happen (race conditions are hard), but I think the change is safe to add regardless.

@Saadnajmi Saadnajmi requested a review from a team as a code owner March 29, 2025 00:59
@Saadnajmi Saadnajmi changed the title fix: dismiss all sheets when [RCTDevLoadingView hide] is called fix: dismiss all sheets created by RCTDevLoadingView when hide is called Mar 31, 2025
@Saadnajmi Saadnajmi merged commit 9ea059c into microsoft:main Apr 8, 2025
12 checks passed
@Saadnajmi Saadnajmi deleted the panels branch April 8, 2025 23:54
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Apr 8, 2025
… called (microsoft#2448)

## Summary:

We've had a recurring bug where `RCTDevLoadingView` stick around
blocking the whole app even after it's dismissed. As far as I can tell,
this is a race condition where we have multiple devloadingviews at once
(each setting and nilling the same `self->_window` property), which is
causing a race condition. Rather than figure out how to make this class
only ever show one window or race-safe, for now I will just make sure to
dismiss _all_ sheets when `hide` is called.

While we're at it, a couple of other changes:
1. Change the type from `NSPanel` to `NSWindow`. Panels don't release
when closed, which may be causing them to stick around longer than we
like
2. Move the iOS only variable `mainWindow` into the iOS ifdef, and
remove the diffs and diff tag around it.

## Test Plan:

Initial testing shows RNTester no longer getting blocked. It could still
happen (race conditions are hard), but I think the change is safe to add
regardless.
Saadnajmi added a commit to Saadnajmi/react-native-macos that referenced this pull request Apr 8, 2025
… called (microsoft#2448)

## Summary:

We've had a recurring bug where `RCTDevLoadingView` stick around
blocking the whole app even after it's dismissed. As far as I can tell,
this is a race condition where we have multiple devloadingviews at once
(each setting and nilling the same `self->_window` property), which is
causing a race condition. Rather than figure out how to make this class
only ever show one window or race-safe, for now I will just make sure to
dismiss _all_ sheets when `hide` is called.

While we're at it, a couple of other changes:
1. Change the type from `NSPanel` to `NSWindow`. Panels don't release
when closed, which may be causing them to stick around longer than we
like
2. Move the iOS only variable `mainWindow` into the iOS ifdef, and
remove the diffs and diff tag around it.

## Test Plan:

Initial testing shows RNTester no longer getting blocked. It could still
happen (race conditions are hard), but I think the change is safe to add
regardless.
Saadnajmi added a commit that referenced this pull request Apr 9, 2025
Saadnajmi added a commit that referenced this pull request Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants