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:
parent
d56ff77308
commit
206f70cf34
2 changed files with 18 additions and 17 deletions
|
@ -150,21 +150,25 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Check connection status on initial page load
|
// Check connection status on initial page load
|
||||||
const apiClient = ServerConnections.currentApiClient();
|
const apiClient = ServerConnections.currentApiClient();
|
||||||
const firstConnection = ServerConnections.firstConnection;
|
const connection = Promise.resolve(ServerConnections.firstConnection ? null : ServerConnections.connect());
|
||||||
console.debug('[ConnectionRequired] connection state', firstConnection?.State);
|
connection.then(firstConnection => {
|
||||||
ServerConnections.firstConnection = null;
|
console.debug('[ConnectionRequired] connection state', firstConnection?.State);
|
||||||
|
ServerConnections.firstConnection = true;
|
||||||
|
|
||||||
if (firstConnection && firstConnection.State !== ConnectionState.SignedIn && !apiClient?.isLoggedIn()) {
|
if (firstConnection && firstConnection.State !== ConnectionState.SignedIn && !apiClient?.isLoggedIn()) {
|
||||||
handleIncompleteWizard(firstConnection)
|
handleIncompleteWizard(firstConnection)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error('[ConnectionRequired] could not start wizard', err);
|
console.error('[ConnectionRequired] could not start wizard', err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
validateUserAccess()
|
validateUserAccess()
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error('[ConnectionRequired] could not validate user access', err);
|
console.error('[ConnectionRequired] could not validate user access', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[ConnectionRequired] failed to connect', err);
|
||||||
|
});
|
||||||
}, [handleIncompleteWizard, validateUserAccess]);
|
}, [handleIncompleteWizard, validateUserAccess]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
|
|
@ -110,9 +110,6 @@ build: ${__JF_BUILD_VERSION__}`);
|
||||||
Events.on(apiClient, 'requestfail', appRouter.onRequestFail);
|
Events.on(apiClient, 'requestfail', appRouter.onRequestFail);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Connect to server
|
|
||||||
ServerConnections.firstConnection = await ServerConnections.connect();
|
|
||||||
|
|
||||||
// Render the app
|
// Render the app
|
||||||
await renderApp();
|
await renderApp();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue