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();
|
const abortController = new AbortController();
|
||||||
defaultServerService.server
|
defaultServerService.server
|
||||||
.waitForConfigRevalidation(abortController.signal)
|
.waitForConfigRevalidation(abortController.signal)
|
||||||
.then(() => {
|
.then(() => setIsServerReady(true))
|
||||||
setIsServerReady(true);
|
.catch(console.error);
|
||||||
})
|
return () => abortController.abort();
|
||||||
.catch(error => {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
return () => {
|
|
||||||
abortController.abort();
|
|
||||||
};
|
|
||||||
}, [defaultServerService, isServerReady]);
|
}, [defaultServerService, isServerReady]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -17,15 +17,9 @@ export const RootWrapper = () => {
|
|||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
defaultServerService.server
|
defaultServerService.server
|
||||||
.waitForConfigRevalidation(abortController.signal)
|
.waitForConfigRevalidation(abortController.signal)
|
||||||
.then(() => {
|
.then(() => setIsServerReady(true))
|
||||||
setIsServerReady(true);
|
.catch(console.error);
|
||||||
})
|
return () => abortController.abort();
|
||||||
.catch(error => {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
return () => {
|
|
||||||
abortController.abort();
|
|
||||||
};
|
|
||||||
}, [defaultServerService, isServerReady]);
|
}, [defaultServerService, isServerReady]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -100,11 +100,16 @@ export class Server extends Entity<{
|
|||||||
);
|
);
|
||||||
|
|
||||||
async waitForConfigRevalidation(signal?: AbortSignal) {
|
async waitForConfigRevalidation(signal?: AbortSignal) {
|
||||||
this.revalidateConfig();
|
try {
|
||||||
await this.isConfigRevalidating$.waitFor(
|
this.revalidateConfig();
|
||||||
isRevalidating => !isRevalidating,
|
await this.isConfigRevalidating$.waitFor(
|
||||||
signal
|
isRevalidating => !isRevalidating,
|
||||||
);
|
signal
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Event && error.type === 'abort') return;
|
||||||
|
console.error('Config revalidation failed:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override dispose(): void {
|
override dispose(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user