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

fix: preview fails when page has missing author #1886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shigugu
Copy link

@Shigugu Shigugu commented Dec 19, 2024

After importing a WP blog into Publii, the preview changes process failed with the following error:

Details

TypeError: Cannot read properties of undefined (reading 'name') at RendererContextPage.setContext (/home/git/fork-Publii/app/back-end/modules/render-html/contexts/page.js:110:86) at RendererContextPage.getContext (/home/git/fork-Publii/app/back-end/modules/render-html/contexts/page.js:144:14) at Renderer.generatePages (/home/git/fork-Publii/app/back-end/modules/render-html/renderer.js:1279:44) at Renderer.generateWWW (/home/git/fork-Publii/app/back-end/modules/render-html/renderer.js:242:18) at Renderer.renderFullPreview (/home/git/fork-Publii/app/back-end/modules/render-html/renderer.js:193:20) at Renderer.renderSite (/home/git/fork-Publii/app/back-end/modules/render-html/renderer.js:174:28) at Renderer.render (/home/git/fork-Publii/app/back-end/modules/render-html/renderer.js:119:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async process. (/home/git/fork-Publii/app/back-end/workers/renderer/preview.js:17:22)

To fix it, I added optional chaining operators in app/back-end/modules/render-html/contexts/page.js when accessing a page's author's name

add optional chaining operators when accessing a page's author's name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant