fix: register command re-rendering (#4476)

This commit is contained in:
Peng Xiao 2023-09-25 10:40:53 +08:00 committed by GitHub
parent 5f7f5b74ca
commit dc6b66c32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import type { WorkspaceSubPath } from '@affine/env/workspace';
import { useCallback } from 'react';
import { useCallback, useMemo } from 'react';
import {
type NavigateOptions,
useLocation,
@ -103,14 +103,26 @@ export function useNavigateHelper() {
[navigate]
);
return {
jumpToPage,
jumpToPublicWorkspacePage,
jumpToSubPath,
jumpToIndex,
jumpTo404,
openPage,
jumpToExpired,
jumpToSignIn,
};
return useMemo(
() => ({
jumpToPage,
jumpToPublicWorkspacePage,
jumpToSubPath,
jumpToIndex,
jumpTo404,
openPage,
jumpToExpired,
jumpToSignIn,
}),
[
jumpTo404,
jumpToExpired,
jumpToIndex,
jumpToPage,
jumpToPublicWorkspacePage,
jumpToSignIn,
jumpToSubPath,
openPage,
]
);
}