Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): remove abort event error on init #9465

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/frontend/core/src/desktop/pages/root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ export const RootWrapper = () => {
const abortController = new AbortController();
defaultServerService.server
.waitForConfigRevalidation(abortController.signal)
.then(() => {
setIsServerReady(true);
})
.catch(error => {
console.error(error);
});
return () => {
abortController.abort();
};
.then(() => setIsServerReady(true))
.catch(console.error);
return () => abortController.abort();
doodlewind marked this conversation as resolved.
Show resolved Hide resolved
}, [defaultServerService, isServerReady]);

return (
Expand Down
12 changes: 3 additions & 9 deletions packages/frontend/core/src/mobile/pages/root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ export const RootWrapper = () => {
const abortController = new AbortController();
defaultServerService.server
.waitForConfigRevalidation(abortController.signal)
.then(() => {
setIsServerReady(true);
})
.catch(error => {
console.error(error);
});
return () => {
abortController.abort();
};
.then(() => setIsServerReady(true))
.catch(console.error);
return () => abortController.abort();
}, [defaultServerService, isServerReady]);

return (
Expand Down
15 changes: 10 additions & 5 deletions packages/frontend/core/src/modules/cloud/entities/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,16 @@ export class Server extends Entity<{
);

async waitForConfigRevalidation(signal?: AbortSignal) {
this.revalidateConfig();
await this.isConfigRevalidating$.waitFor(
isRevalidating => !isRevalidating,
signal
);
try {
this.revalidateConfig();
await this.isConfigRevalidating$.waitFor(
isRevalidating => !isRevalidating,
signal
);
} catch (error) {
if (error instanceof Event && error.type === 'abort') return;
console.error('Config revalidation failed:', error);
}
}

override dispose(): void {
Expand Down
Loading