You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/init.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ function getDefaultServerURLs(appId) {
29
29
}
30
30
31
31
let_disableAppRouter=false;
32
+
let_initialized=false;
32
33
33
34
/**
34
35
* URLs for services
@@ -71,7 +72,10 @@ AV.init = function init(options, ...params) {
71
72
production,
72
73
realtime,
73
74
}=options;
74
-
if(AV.applicationId)thrownewError('SDK is already initialized.');
75
+
if(_initialized)
76
+
console.warn(
77
+
'Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations.'
78
+
);
75
79
if(!appId)thrownewTypeError('appId must be a string');
76
80
if(!appKey)thrownewTypeError('appKey must be a string');
77
81
if(process.env.CLIENT_PLATFORM&&masterKey)
@@ -117,6 +121,7 @@ AV.init = function init(options, ...params) {
117
121
},
118
122
});
119
123
}
124
+
_initialized=true;
120
125
};
121
126
122
127
// If we're running in node.js, allow using the master key.
0 commit comments