Skip to content

Commit 1e8a368

Browse files
jlengstorferezrokah
authored andcommitted
fix: prevent double initialization
1 parent 3da5e34 commit 1e8a368

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/netlify-identity.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,14 @@ observe(store, "siteURL", () => {
151151
if (store.siteURL === null || store.siteURL === undefined) {
152152
localStorage.removeItem("netlifySiteURL");
153153
} else {
154+
const currentURL = localStorage.getItem("netlifySiteURL");
155+
156+
// if nothing has changed, don’t do anything
157+
if (currentURL === store.siteURL) return;
158+
154159
localStorage.setItem("netlifySiteURL", store.siteURL);
160+
store.init(instantiateGotrue(), true);
155161
}
156-
store.init(instantiateGotrue(), true);
157162
});
158163

159164
observe(store, "user", () => {

0 commit comments

Comments
 (0)