perf: getEnvironment() -> env (#2636)

This commit is contained in:
Simon He
2023-06-01 11:23:38 +08:00
committed by GitHub
parent e1314730be
commit fc9462eee9
16 changed files with 70 additions and 86 deletions
@@ -1,4 +1,4 @@
import { getEnvironment } from '@affine/env/config';
import { env } from '@affine/env/config';
import { atomWithObservable, atomWithStorage } from 'jotai/utils';
import { Observable } from 'rxjs';
@@ -21,9 +21,8 @@ function rpcToObservable<
) {
return new Observable<T>(subscriber => {
subscriber.next(initialValue);
const environment = getEnvironment();
onSubscribe?.();
if (typeof window === 'undefined' || !environment.isDesktop || !event) {
if (typeof window === 'undefined' || !env.isDesktop || !event) {
subscriber.complete();
return () => {};
}