Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EditCollectionPage] Left navigation pages prop not passed if URL is accessed directly #19

Closed
kwajiehao opened this issue Oct 29, 2019 · 1 comment
Labels
bug Something isn't working P1 Do it now.

Comments

@kwajiehao
Copy link
Contributor

kwajiehao commented Oct 29, 2019

To render the left navigation bar in a Collections page accurately, we need to know the titles of all the pages in the collection. Right now, this is done by passing a prop pages into the link in CollectionPages like so:

 <Link to={{
     pathname: `/sites/${siteName}/collections/${collectionName}/${page.fileName}`,
     state: {
         pages,
     },
}}
>

And it is subsequently accessed in EditCollectionPage:

const { match, location } = this.props;
const { pages } = location.state;

However, if EditCollectionPage is accessed by its URL and not by the link, then the pages prop is not passed and { pages } becomes undefined in EditCollectionPage.

This should be fixed by calling the Github API directly in EditCollectionPage rather than passing a prop accessible only when the link is used.

@kwajiehao
Copy link
Contributor Author

Resolved in #64 by making a call to the collections endpoint to get all pages in the collection

@kwajiehao kwajiehao added the P1 Do it now. label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Do it now.
Projects
None yet
Development

No branches or pull requests

1 participant