Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix component inspector error in React Native (#32628)
An issue cropped up where the inspector (Debug Menu > Show Inspector) showed a red screen when loading. This happens because on loading the inspector, a hook is called which checks the editor capabilities. If the reusable block capability is `false`, the reusable block type is then unregistered. What seems to happen when opening the inspector is that the editor does not fully reload, so the reusable block is already unregistered and the app tries to unregister it again, causing a red screen. The fix here is to only unregister the block if it's currently registered. An alternative approach might be to put the code that unregisters the block in a hook that's only called when the editor is first loaded, not when it's only partially reloaded by the inspector.
- Loading branch information