import { PbContext } from "~/graphql/types" ; import { ContextPlugin } from "@webiny/handler" ; export default ( ) => { return new ContextPlugin < PbContext > ( async ( context ) => { context . pageBuilder . onAfterPageDelete . subscribe ( async ( params ) => { const { page , publishedPage } = params ; /**
             * Published pages have this record.
             */ if ( ! publishedPage ) { return ; } if ( page . version === 1 ) { return context . pageBuilder . prerendering . flush ( { context , paths : [ { path : publishedPage . path } ] } ) ; } /**
             * If the published version was deleted.
             */ const isPublished = publishedPage . id === page . id ; if ( isPublished ) { return context . pageBuilder . prerendering . flush ( { context , paths : [ { path : publishedPage . path } ] } ) ; } } ) ; } ) ; } ;