fix: page link construction (#6312)
This commit is contained in:
parent
88c26b334d
commit
24cc69fd7b
1 changed files with 12 additions and 8 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { useParams } from "next/navigation";
|
|
||||||
// plane editor
|
// plane editor
|
||||||
import { EditorRefApi } from "@plane/editor";
|
import { EditorRefApi } from "@plane/editor";
|
||||||
// plane types
|
// plane types
|
||||||
|
|
@ -34,15 +33,22 @@ export const usePageOperations = (
|
||||||
pageOperations: TPageOperations;
|
pageOperations: TPageOperations;
|
||||||
} => {
|
} => {
|
||||||
const { page } = props;
|
const { page } = props;
|
||||||
// params
|
|
||||||
const { workspaceSlug, projectId } = useParams();
|
|
||||||
// derived values
|
// derived values
|
||||||
const { access, addToFavorites, archived_at, duplicate, id, is_favorite, is_locked, removePageFromFavorites } = page;
|
const {
|
||||||
|
access,
|
||||||
|
addToFavorites,
|
||||||
|
archived_at,
|
||||||
|
duplicate,
|
||||||
|
is_favorite,
|
||||||
|
is_locked,
|
||||||
|
getRedirectionLink,
|
||||||
|
removePageFromFavorites,
|
||||||
|
} = page;
|
||||||
// collaborative actions
|
// collaborative actions
|
||||||
const { executeCollaborativeAction } = useCollaborativePageActions(props);
|
const { executeCollaborativeAction } = useCollaborativePageActions(props);
|
||||||
// page operations
|
// page operations
|
||||||
const pageOperations: TPageOperations = useMemo(() => {
|
const pageOperations: TPageOperations = useMemo(() => {
|
||||||
const pageLink = projectId ? `${workspaceSlug}/projects/${projectId}/pages/${id}` : `${workspaceSlug}/pages/${id}`;
|
const pageLink = getRedirectionLink();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
copyLink: () => {
|
copyLink: () => {
|
||||||
|
|
@ -184,12 +190,10 @@ export const usePageOperations = (
|
||||||
archived_at,
|
archived_at,
|
||||||
duplicate,
|
duplicate,
|
||||||
executeCollaborativeAction,
|
executeCollaborativeAction,
|
||||||
id,
|
getRedirectionLink,
|
||||||
is_favorite,
|
is_favorite,
|
||||||
is_locked,
|
is_locked,
|
||||||
projectId,
|
|
||||||
removePageFromFavorites,
|
removePageFromFavorites,
|
||||||
workspaceSlug,
|
|
||||||
]);
|
]);
|
||||||
return {
|
return {
|
||||||
pageOperations,
|
pageOperations,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue