mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor: environment setup (#2898)
Co-authored-by: Simon He <57086651+Simon-He95@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { isBrowser } from '@affine/env/constant';
|
||||
import type { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import type { WorkspaceVersion } from '@affine/env/workspace';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
@@ -44,14 +45,12 @@ export const rootWorkspacesMetadataAtom = atomWithStorage<
|
||||
export const rootCurrentWorkspaceIdAtom = atom<string | null>(null);
|
||||
|
||||
rootCurrentWorkspaceIdAtom.onMount = set => {
|
||||
if (typeof window !== 'undefined') {
|
||||
if (isBrowser) {
|
||||
const callback = (url: string) => {
|
||||
const value = url.split('/')[2];
|
||||
if (value) {
|
||||
set(value);
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem('last_workspace_id', value);
|
||||
}
|
||||
localStorage.setItem('last_workspace_id', value);
|
||||
} else {
|
||||
set(null);
|
||||
}
|
||||
@@ -68,7 +67,7 @@ rootCurrentWorkspaceIdAtom.onMount = set => {
|
||||
export const rootCurrentPageIdAtom = atom<string | null>(null);
|
||||
|
||||
rootCurrentPageIdAtom.onMount = set => {
|
||||
if (typeof window !== 'undefined') {
|
||||
if (isBrowser) {
|
||||
const callback = (url: string) => {
|
||||
const value = url.split('/')[3];
|
||||
if (value) {
|
||||
|
||||
Reference in New Issue
Block a user