1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix async route page refresh

This commit is contained in:
viown 2024-12-15 14:01:12 +03:00
parent d56ff77308
commit 206f70cf34
2 changed files with 18 additions and 17 deletions

View file

@ -150,9 +150,10 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
useEffect(() => {
// Check connection status on initial page load
const apiClient = ServerConnections.currentApiClient();
const firstConnection = ServerConnections.firstConnection;
const connection = Promise.resolve(ServerConnections.firstConnection ? null : ServerConnections.connect());
connection.then(firstConnection => {
console.debug('[ConnectionRequired] connection state', firstConnection?.State);
ServerConnections.firstConnection = null;
ServerConnections.firstConnection = true;
if (firstConnection && firstConnection.State !== ConnectionState.SignedIn && !apiClient?.isLoggedIn()) {
handleIncompleteWizard(firstConnection)
@ -165,6 +166,9 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
console.error('[ConnectionRequired] could not validate user access', err);
});
}
}).catch(err => {
console.error('[ConnectionRequired] failed to connect', err);
});
}, [handleIncompleteWizard, validateUserAccess]);
if (isLoading) {

View file

@ -110,9 +110,6 @@ build: ${__JF_BUILD_VERSION__}`);
Events.on(apiClient, 'requestfail', appRouter.onRequestFail);
});
// Connect to server
ServerConnections.firstConnection = await ServerConnections.connect();
// Render the app
await renderApp();