Skip to content

Commit

Permalink
Fix setRuntimeConfigProvider multiple times error
Browse files Browse the repository at this point in the history
Summary:
Fix the following error:
 {F1038388240}

Calling ```setRuntimeConfigProvider``` multiple times is not always a wrong behaviour, the following could happen and before this diff App C will raise above error:
- App A has main bundle X
- App B has main bundle Y
- App C has main bundle X and bundle Y

To fix we guarantee ```setRuntimeConfigProvider``` only called once instead of raising an error.

Changelog:
[iOS][Changed] Fix setRuntimeConfigProvider called multiple times error

Reviewed By: dmytrorykun

Differential Revision: D47094267

fbshipit-source-id: c8473f4f7d639a73e0201c6d72781c01e6cf95fd
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Jun 28, 2023
1 parent 3ecbc1d commit 637ffb1
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ export function setRuntimeConfigProvider(
verify: boolean,
},
): void {
invariant(
getRuntimeConfig == null,
'NativeComponentRegistry.setRuntimeConfigProvider() called more than once.',
);
getRuntimeConfig = runtimeConfigProvider;
if (getRuntimeConfig === undefined) {
getRuntimeConfig = runtimeConfigProvider;
}
}

/**
Expand Down

0 comments on commit 637ffb1

Please sign in to comment.