-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hi
We’re implementing preview functionality and are experiencing issues when resolving related content (e.g., a header) in preview mode.
When previewing a content page, additional content is queried. For example, a header (configured as a _page).
We are using the getPreviewContent function, which requires the following parameters:
key: string;
ctx: string;
ver: string;
loc: string;
The Issue
The problem concerns the ver (version) parameter.
• The ver value from the searchParams represents the version of the page currently being previewed.
• When fetching related content (e.g., the header), we do not have the specific draft version identifier for that content.
• The ver parameter is required.
Observed behavior:
1. If we omit ver, the function still returns content.
However, it is unclear which version is being returned (it does not appear to be the latest draft version and also not the published version).
2. If we pass the same version number as the previewed page, the function throws an error:
“Error [GraphResponseError]: No content found for key [2ca669d992f1489ca46b1797e5e4c739]. Check that your CMS contains something there”
This error message is also misleading, since the content does exist, just not with that specific version.
Expected behavior
The function getPreviewContent should not require a version and the API should automatically resolve to the latest draft version when no ver is provided.
Thank you