realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Revisit our workaround for flushing the microtask queue after calls from C++ into JS

Open kraenhansen opened this issue 7 months ago • 1 comments

About two years ago we merged a few PRs (#4725, #4579 and #4389) working around this issue in React Native: https://github.com/facebook/react-native/issues/33006.

About 4 months ago a PR landed in React Native hinting that this might have been solved by enabling the Hermes microtask queue when bridgeless is enabled: https://github.com/facebook/react-native/pull/43396. My initial (limited) investigation wasn't able to confirm this though (see my comments on the PR).

Our current workaround triggers this warning in React Native's BridgelessReactContext:

BridgelessReactContext: [WARNING] Bridgeless doesn't support CatalystInstance. Accessing an API that's not part of the new architecture is not encouraged usage.

I see a few ways forward:

  1. Trigger a flush of the microtask queue in another way, likely through JSI's drainMicrotasks
  2. Create a minimal reproduction for React Native to reproduce and fix the underlying issue.

kraenhansen avatar Jun 28 '24 07:06 kraenhansen