All files / apps/developer-portal/layers/wiki/app/composables useWikiHome.ts

100% Statements 11/11
50% Branches 1/2
100% Functions 7/7
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  1x 4x 4x   4x 4x 9x       4x     4x 4x        
/** The collected docs and the wiki tree the front page reads; `ready` settles once the tree loads. */
export const useWikiHome = () => {
    const wiki = useWiki();
    const sections = wiki.data;
 
    const entries = computed(() =>
        sections.value.flatMap((section) =>
            section.groups.flatMap((group) => group.entries.map((entry) => entry.path)),
        ),
    );
 
    return {
        sections,
        pages: docsArtifact()?.pages ?? [],
        count: computed(() => entries.value.length),
        known: computed(() => new Set(entries.value)),
        ready: wiki,
    };
};