Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: register command re-rendering (#4476)

Peng Xiaodc6b66c32faa
diff --git a/apps/core/src/hooks/use-navigate-helper.ts b/apps/core/src/hooks/use-navigate-helper.ts
index d5713eb697..5b677afea0 100644
--- a/apps/core/src/hooks/use-navigate-helper.ts
+++ b/apps/core/src/hooks/use-navigate-helper.ts
@@ -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,
+ ]
+ );
}