mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix: resolve initialization race conditions in NostrClient and app startup
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
e6a73687dd
commit
8a2deab842
1 file changed
+30
-28
+30
-28
@@ -617,20 +617,6 @@ async function bootstrapInterface() {
|
||||
|
||||
devLogger.log("Modals loaded.");
|
||||
|
||||
if (
|
||||
application &&
|
||||
typeof application.initializeLoginModalController === "function"
|
||||
) {
|
||||
try {
|
||||
application.initializeLoginModalController();
|
||||
} catch (error) {
|
||||
devLogger.error(
|
||||
"[Interface] Failed to initialize login modal controller after loading markup:",
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
[
|
||||
"loginModal",
|
||||
"nostrFormModal",
|
||||
@@ -982,20 +968,6 @@ async function bootstrapInterface() {
|
||||
updateSidebarDropupContentWidth();
|
||||
}
|
||||
|
||||
try {
|
||||
await applicationReadyPromise;
|
||||
} catch (error) {
|
||||
// fall through
|
||||
}
|
||||
|
||||
if (application && typeof application.hydrateSidebarNavigation === "function") {
|
||||
try {
|
||||
application.hydrateSidebarNavigation();
|
||||
} catch (error) {
|
||||
devLogger.warn("[Interface] Failed to hydrate sidebar navigation:", error);
|
||||
}
|
||||
}
|
||||
|
||||
bindOptionalExternalLink({
|
||||
selector: "[data-blog-link]",
|
||||
url: BLOG_URL,
|
||||
@@ -1267,6 +1239,36 @@ async function bootstrapInterface() {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
await applicationReadyPromise;
|
||||
} catch (error) {
|
||||
// fall through
|
||||
}
|
||||
|
||||
if (application) {
|
||||
if (typeof application.initializeLoginModalController === "function") {
|
||||
try {
|
||||
application.initializeLoginModalController();
|
||||
} catch (error) {
|
||||
devLogger.error(
|
||||
"[Interface] Failed to initialize login modal controller:",
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof application.hydrateSidebarNavigation === "function") {
|
||||
try {
|
||||
application.hydrateSidebarNavigation();
|
||||
} catch (error) {
|
||||
devLogger.warn(
|
||||
"[Interface] Failed to hydrate sidebar navigation:",
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleQueryParams();
|
||||
|
||||
window.addEventListener("hashchange", handleHashChange);
|
||||
|
||||
Reference in new issue
Block a user