You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
// Check if preview mode is active and valid for current post (preview and post IDs or slugs match).
constisCurrentPostPreview=
preview&&
(postId===previewData?.post?.id||
// Compare URIs with leading and trailing slashes stripped.
postId.replace(/^\/|\/$/g,'')===
previewData?.post?.uri?.replace(/^\/|\/$/g,''))
The problem seems to be on lines 159-160, where previewData?.post?.uri would be /2022/02/22/hello-world/ whereas postId would contain the slug, i.e. hello-world, therefore that check will always return false
The text was updated successfully, but these errors were encountered:
Describe the bug
Preview doesn't seem to be working when posts use nested URIs, e.g.
/2022/02/22/hello-world/
To Reproduce
Day and name
structure for the permalinksExpected behavior
Unsaved changes and the preview top bar are both visible.
Additional context
nextjs-wordpress-starter/frontend/functions/wordpress/postTypes/getPostTypeStaticProps.js
Lines 154 to 160 in dab0be0
The problem seems to be on lines 159-160, where
previewData?.post?.uri
would be/2022/02/22/hello-world/
whereaspostId
would contain the slug, i.e.hello-world
, therefore that check will always returnfalse
The text was updated successfully, but these errors were encountered: