mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
refactor(infra): remove setimmediate (#7975)
This commit is contained in:
@@ -122,9 +122,10 @@ export class ComponentCachePool {
|
||||
try {
|
||||
i[Symbol.dispose]();
|
||||
} catch (err) {
|
||||
setImmediate(() => {
|
||||
// make a uncaught exception
|
||||
setTimeout(() => {
|
||||
throw err;
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,21 +93,24 @@ export function effect(...args: any[]) {
|
||||
const subscription = subject$.pipe.apply(subject$, args as any).subscribe({
|
||||
next(value) {
|
||||
const error = new EffectError('should not emit value', value);
|
||||
setImmediate(() => {
|
||||
// make a uncaught exception
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
complete() {
|
||||
const error = new EffectError('effect unexpected complete');
|
||||
setImmediate(() => {
|
||||
// make a uncaught exception
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
error(error) {
|
||||
const effectError = new EffectError('effect uncaught error', error);
|
||||
setImmediate(() => {
|
||||
// make a uncaught exception
|
||||
setTimeout(() => {
|
||||
throw effectError;
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -458,7 +458,8 @@ export class LiveData<T = unknown>
|
||||
const subscription = this.subscribe(v => {
|
||||
if (predicate(v)) {
|
||||
resolve(v as any);
|
||||
setImmediate(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
Promise.resolve().then(() => {
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'setimmediate';
|
||||
import '@affine/component/theme/global.css';
|
||||
import '@affine/component/theme/theme.css';
|
||||
import '@affine/core/bootstrap/preload';
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
import 'setimmediate';
|
||||
@@ -1 +0,0 @@
|
||||
import 'setimmediate';
|
||||
Reference in New Issue
Block a user