Skip to content

Commit

Permalink
fix: update aco table record on page revision deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
leopuleo authored and adrians5j committed Aug 14, 2023
1 parent 5335a36 commit a9e3a2f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as GQLCache from "~/admin/views/Pages/cache";
import { useAdminPageBuilder } from "~/admin/hooks/useAdminPageBuilder";
import { PbPageData, PbPageRevision } from "~/types";
import { useNavigatePage } from "~/admin/hooks/useNavigatePage";
import { useRecords } from "@webiny/app-aco";

interface UseRevisionHandlersProps {
page: PbPageData;
Expand All @@ -21,6 +22,7 @@ export function useRevisionHandlers(props: UseRevisionHandlersProps) {
const { publishRevision, unpublishRevision } = usePublishRevisionHandler();
const pageBuilder = useAdminPageBuilder();
const { navigateToPageEditor } = useNavigatePage();
const { getRecord } = useRecords();

const createRevision = useCallback(async () => {
const { data: res } = await client.mutate({
Expand Down Expand Up @@ -75,6 +77,10 @@ export function useRevisionHandlers(props: UseRevisionHandlersProps) {
}
}
});

// Sync ACO record - retrieve the most updated record and update table
await getRecord(page.pid);

if (response) {
const { error } = response;
if (error) {
Expand Down

0 comments on commit a9e3a2f

Please sign in to comment.