Skip to content

Commit

Permalink
Fix optional PageTreeReadApi in `BlocksTransformerMiddlewareFactory…
Browse files Browse the repository at this point in the history
…` (v5) (#2535)

Backport of #2530 into v5.
  • Loading branch information
johnnyomair committed Sep 17, 2024
1 parent ea3902a commit bfd083f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-dolls-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-api": patch
---

Fix optional `PageTreeReadApi` in `BlocksTransformerMiddlewareFactory`
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export class BlocksTransformerMiddlewareFactory {
fieldValue,
{
...dependencies,
pageTreeReadApi: (dependencies.pageTreeService as PageTreeService).createReadApi({
visibility: [PageTreeNodeVisibility.Published, ...(includeInvisiblePages || [])],
}),
pageTreeReadApi: dependencies.pageTreeService
? (dependencies.pageTreeService as PageTreeService).createReadApi({
visibility: [PageTreeNodeVisibility.Published, ...(includeInvisiblePages || [])],
})
: undefined,
},
{ includeInvisibleContent: includeInvisibleBlocks, previewDamUrls },
);
Expand Down

0 comments on commit bfd083f

Please sign in to comment.