Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WMDatabaseBridge compatibility with Bridgeless architecture #1875

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

limbo56
Copy link
Contributor

@limbo56 limbo56 commented Jan 13, 2025

This pull request addresses the following NullPointerException that occurs on app reload in the new architecture:

Caused by: java.lang.NullPointerException
    at com.facebook.react.runtime.BridgelessCatalystInstance.getReactQueueConfiguration(BridgelessCatalystInstance.kt:116)
    at com.nozbe.watermelondb.WMDatabaseBridge.invalidate(WMDatabaseBridge.java:251)
    at com.facebook.react.internal.turbomodule.core.TurboModuleManager.invalidate(TurboModuleManager.java:417)
    at com.facebook.react.runtime.ReactInstance.destroy(ReactInstance.java:462)
    at com.facebook.react.runtime.ReactHostImpl.lambda$getOrCreateDestroyTask$41(ReactHostImpl.java:1701)
    at com.facebook.react.runtime.ReactHostImpl.$r8$lambda$JjSvGyrjIWnRG8yxfoNdD4824hc(Unknown Source:0)
    at com.facebook.react.runtime.ReactHostImpl$$ExternalSyntheticLambda32.then(D8$$SyntheticClass:0)
    at com.facebook.react.runtime.internal.bolts.Task$8.run(Task.java:460)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644at java.lang.Thread.run(Thread.java:1012

This issue arises because the new Bridgeless architecture does not support CatalystInstance, as described in the React Native source code.

This change updates WMDatabaseBridge to use runOnJSQueueThread() instead of getCatalystInstance().getReactQueueConfiguration().getJSQueueThread().runOnQueue(), ensuring compatibility with the Bridgeless architecture.

This commit updates WMDatabaseBridge to use getJSMessageQueueThread()
instead of getCatalystInstance().getReactQueueConfiguration().getJSQueueThread().
The change addresses a NullPointerException when running on the Bridgeless architecture,
which no longer supports CatalystInstance.
This change replaces getJSMessageQueueThread().runOnQueue() with runOnJSQueueThread() to improve readability and consistency with updated APIs.

Co-authored-by: @dppo <[email protected]>
@CodeWithBlaze
Copy link

CodeWithBlaze commented Jan 27, 2025

Can you check and merge this @radex please. I need this fix. Don't want to go for patching for now. This is any way a good fix as now most of the react native app will use 0.76. so please merge it

@MarzyCoder
Copy link

I can confirm, this patch works very well with the new architecture. Please merge it! @radex

@MarzyCoder
Copy link

Why is there no reaction here? It's an important bugfix?

@CodeWithBlaze
Copy link

CodeWithBlaze commented Feb 2, 2025

I have mailed him related to this. I hope he responds and take care of this thing. I am blocked unless this feature is added 🥲

@MarzyCoder
Copy link

MarzyCoder commented Feb 8, 2025

I'm surprised that no one cares about this. At least an answer would be nice.

@radex radex merged commit 4a0e997 into Nozbe:master Feb 10, 2025
5 of 6 checks passed
@radex
Copy link
Collaborator

radex commented Feb 10, 2025

merged, pushed a 0.28.0-2 pre-release to npm

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.

4 participants