React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
73
stars
26
forks
source link
[Bug]: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once. #129
OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.
Regardless of how you initialize OneSignal.
Code below:
const [isInitializedOneSignal, setIsInitializedOneSignal] = useState(false);
const initOneSignal = useCallback(async () => {
// If OneSignal is already initialized then return
if (isInitializedOneSignal) {
return;
}
// Initialize OneSignal
await OneSignal.init({
appId: 'MY-APP-ID',
allowLocalhostAsSecureOrigin: true
});
setIsInitializedOneSignal(true);
// Open subscribe prompt
OneSignal.Slidedown.promptPush();
}, [isInitializedOneSignal]);
// Initialize One Signal
useEffect(() => {
void initOneSignal();
},[initOneSignal]);
What browsers are you seeing the problem on?
Firefox, Chrome (Chromium), Safari, Microsoft Edge, Opera, Brave
What happened?
The package seems to be throwing this new error:
OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.
Regardless of how you initialize OneSignal.
Code below:
What browsers are you seeing the problem on?
Firefox, Chrome (Chromium), Safari, Microsoft Edge, Opera, Brave
What operating system are you running?
asdasasdasasdasasdasasdas
Steps to reproduce?
What did you expect to happen?
Should not throw any errors
Relevant log output
No response