We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7121c42 commit 2dbf833Copy full SHA for 2dbf833
Modules/@babylonjs/react-native/NativeEngineHook.ts
@@ -9,9 +9,18 @@ export function useModuleInitializer(): boolean | undefined {
9
const [initialized, setInitialized] = useState<boolean>();
10
11
useEffect(() => {
12
+ const abortController = new AbortController();
13
(async () => {
- setInitialized(await ensureInitialized());
14
+ const isInitialized = await ensureInitialized();
15
+
16
+ if (!abortController.signal.aborted) {
17
+ setInitialized(isInitialized);
18
+ }
19
})();
20
21
+ return () => {
22
+ abortController.abort();
23
24
}, []);
25
26
return initialized;
0 commit comments