refactor: remove NoSsr on top level (#1951)
This commit is contained in:
1 parent
43a96fe8e3
commit
2383165470
27 files changed
+211
-133
No files matched your search
@@ -2,9 +2,11 @@ import { jotaiWorkspacesAtom } from '@affine/workspace/atom';
|
||||
import type { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import type { WorkspaceRegistry } from '@affine/workspace/type';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { WorkspacePlugins } from '../plugins';
|
||||
import { useRouterHelper } from './use-router-helper';
|
||||
|
||||
/**
|
||||
* Transform workspace from one flavour to another
|
||||
@@ -13,6 +15,8 @@ import { WorkspacePlugins } from '../plugins';
|
||||
*/
|
||||
export function useTransformWorkspace() {
|
||||
const set = useSetAtom(jotaiWorkspacesAtom);
|
||||
const router = useRouter();
|
||||
const helper = useRouterHelper(router);
|
||||
return useCallback(
|
||||
async <From extends WorkspaceFlavour, To extends WorkspaceFlavour>(
|
||||
from: From,
|
||||
@@ -31,8 +35,9 @@ export function useTransformWorkspace() {
|
||||
});
|
||||
return [...workspaces];
|
||||
});
|
||||
await helper.jumpToWorkspace(newId);
|
||||
return newId;
|
||||
},
|
||||
[set]
|
||||
[helper, set]
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user