Skip to content

Commit 24cc69f

Browse files
authored
fix: page link construction (#6312)
1 parent 88c26b3 commit 24cc69f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

web/core/hooks/use-page-operations.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useMemo } from "react";
2-
import { useParams } from "next/navigation";
32
// plane editor
43
import { EditorRefApi } from "@plane/editor";
54
// plane types
@@ -34,15 +33,22 @@ export const usePageOperations = (
3433
pageOperations: TPageOperations;
3534
} => {
3635
const { page } = props;
37-
// params
38-
const { workspaceSlug, projectId } = useParams();
3936
// derived values
40-
const { access, addToFavorites, archived_at, duplicate, id, is_favorite, is_locked, removePageFromFavorites } = page;
37+
const {
38+
access,
39+
addToFavorites,
40+
archived_at,
41+
duplicate,
42+
is_favorite,
43+
is_locked,
44+
getRedirectionLink,
45+
removePageFromFavorites,
46+
} = page;
4147
// collaborative actions
4248
const { executeCollaborativeAction } = useCollaborativePageActions(props);
4349
// page operations
4450
const pageOperations: TPageOperations = useMemo(() => {
45-
const pageLink = projectId ? `${workspaceSlug}/projects/${projectId}/pages/${id}` : `${workspaceSlug}/pages/${id}`;
51+
const pageLink = getRedirectionLink();
4652

4753
return {
4854
copyLink: () => {
@@ -184,12 +190,10 @@ export const usePageOperations = (
184190
archived_at,
185191
duplicate,
186192
executeCollaborativeAction,
187-
id,
193+
getRedirectionLink,
188194
is_favorite,
189195
is_locked,
190-
projectId,
191196
removePageFromFavorites,
192-
workspaceSlug,
193197
]);
194198
return {
195199
pageOperations,

0 commit comments

Comments
 (0)