mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 19:46:32 +08:00
refactor(core): remove abort event error on init (#9465)
Following error always throw on Affine init, which is actually an `Event` from abort controller that can be handled in upstream. 
This commit is contained in:
@@ -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();
|
||||
}, [defaultServerService, isServerReady]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user