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

Theme breaks when posts list has just one item #7

Open
SantosGuillamot opened this issue Feb 4, 2020 · 3 comments
Open

Theme breaks when posts list has just one item #7

SantosGuillamot opened this issue Feb 4, 2020 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@SantosGuillamot
Copy link

If you install the frontity-chakra-ui-theme in a Frontity project, and point it to a WordPress where you just have one post, it stops working and it returns this error:

TypeError: Cannot destructure property `title` of 'undefined' or 'null'.
      at SecondaryPostPreview (webpack-internal:///./packages/frontity-chakra-theme/src/components/featured-post/featured-post.js:13:2258)
      at processChild (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:480:2385)
      at resolve (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:479:122)
      at ReactDOMServerRenderer.render (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:516:1153)
      at ReactDOMServerRenderer.read (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:516:55)
      at renderToString (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:555:116)
      at eval (webpack-internal:///./node_modules/@frontity/core/src/server/index.tsx:45:243)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at eval (webpack-internal:///./node_modules/koa-mount/index.js:16:290)

It seems that the theme is expecting to find a second post (I guess for the homepage, for the first three posts), and as it doesn't exists it returns that error.

@Afiliazon
Copy link

@SantosGuillamot i think the problem is my wordpress site, but testing with frontity's demo blog causes the same error.
Please search multiple times fastest.

@SantosGuillamot
Copy link
Author

I am not able to reproduce the problem. With frontity's demo blog you refer to this one? https://frontity-chakra.now.sh/. I've done multiple searches there and it's working for me.

@Koli14
Copy link
Contributor

Koli14 commented Feb 11, 2020

I had the same issue. If the source point to a WP where there is only 1 or 2 posts, you get the above error message. If you create at least 3 posts, it works.

@luisherranz luisherranz added bug Something isn't working good first issue Good for newcomers labels Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants