Skip to content

Commit

Permalink
Merge pull request #56 from janniks/fix-content
Browse files Browse the repository at this point in the history
Fix missing/pending blocks
  • Loading branch information
tobiaslins authored Oct 6, 2021
2 parents 8b93b03 + bee30a7 commit 6a1af2e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/routes/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ export async function pageRoute(req: HandlerRequest) {
let allBlockKeys;

while (true) {
allBlockKeys = Object.keys(allBlocks);

allBlockKeys = allBlocks[pageId!].value.content
const pendingBlocks = allBlockKeys.flatMap((blockId) => {
const block = allBlocks[blockId];
const content = block.value && block.value.content;

if (!content || (block.value.type === "page" && blockId !== pageId!)) {
// skips pages other than the requested page
return [];
}

const pendingBlocks = allBlockKeys!.filter((blockId) => {
return !allBlocks.hasOwnProperty(blockId)
return content.filter((id: string) => !allBlocks[id]);
});

if (!pendingBlocks.length) {
Expand Down

0 comments on commit 6a1af2e

Please sign in to comment.