a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

get first entity properly

+5 -3
+5 -3
actions/publishToPublication.ts
··· 65 65 root: root_entity, 66 66 }); 67 67 let facts = (data as unknown as Fact<Attribute>[]) || []; 68 - let blocks = getBlocksWithTypeLocal(facts, root_entity); 69 - 70 68 let scan = scanIndexLocal(facts); 69 + let firstEntity = scan.eav(root_entity, "root/page")?.[0]; 70 + if (!firstEntity) throw new Error("No root page"); 71 + let blocks = getBlocksWithTypeLocal(facts, firstEntity?.data.value); 72 + 71 73 let images = blocks 72 74 .filter((b) => b.type === "image") 73 75 .map((b) => scan.eav(b.value, "block/image")[0]); ··· 132 134 .eq("publication", publication_uri), 133 135 ]); 134 136 135 - return { rkey, record }; 137 + return { rkey, record: JSON.parse(JSON.stringify(record)) }; 136 138 } 137 139 138 140 function blocksToRecord(