X Tutup
Skip to content

Unable to get articles in page object  #241

@Yilun-Sun

Description

@Yilun-Sun

Hi, all. When I tried to generate the articles which are in the child hierarchy of the current page, I found there is no such articles attribute in the page object. But page.next and page.previous has. So I turned to the inelegant solution which is to get the articles by something similar to page.next.previous.articles.

I wonder if I could add the articles attribute to the page in encodePage.ts and create a PR for that. Like:

function encodePage(page: Page, summary: Summary): EncodedPage {
    ...

    if (article) {
        ...

        const prevArticle = summary.getPrevArticle(article);
        if (prevArticle) {
            result.previous = encodeSummaryArticle(prevArticle);
        }

        // add articles to result
        const articles = article
            .getArticles()
            .map((article) => encodeSummaryArticle(article))
            .toJS();
        if (articles.length > 0) {
            result.articles = articles;
        }
    }

    ...

    return result;
}

And what is the reason of the articles property is in the page.next but not in the page? When will page.next.articles be used?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup