Skip to content

Commit

Permalink
fix: pass pid instead of id when deleting page and all revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo authored and adrians5j committed Aug 14, 2023
1 parent 3007f82 commit 5335a36
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PbPageData } from "~/types";
import { useConfirmationDialog, useDialog, useSnackbar } from "@webiny/app-admin";
import { useAdminPageBuilder } from "~/admin/hooks/useAdminPageBuilder";
import { useRecords } from "@webiny/app-aco";
import { parseIdentifier } from "@webiny/utils";

const t = i18n.ns("app-headless-cms/app-page-builder/dialogs/dialog-delete-page");

Expand Down Expand Up @@ -35,8 +36,7 @@ export const useDeletePage = ({ page, onDelete }: UseDeletePageParams) => {
const openDialogDeletePage = useCallback(
() =>
showConfirmation(async () => {
const [uniquePageId] = page.id.split("#");
const id = `${uniquePageId}#0001`;
const { id } = parseIdentifier(page.id);
/**
* Delete page using pageBuilder deletePage hook.
*/
Expand Down Expand Up @@ -64,7 +64,7 @@ export const useDeletePage = ({ page, onDelete }: UseDeletePageParams) => {
}

// Sync ACO record - retrieve the most updated record from network
await getRecord(uniquePageId);
await getRecord(id);

showSnackbar(
t`The page "{title}" was deleted successfully.`({
Expand Down

0 comments on commit 5335a36

Please sign in to comment.