Query entries in preview with token within sprig request
See original GitHub issueQuestion
We have a Sprig component which loads a part of the entry dynamically. However, when this entry is not enabled, a query like craft.entries().id(_productId).one()
won´t return the entry since its not enabled yet. (_productId is provided by the sprig component) This happens for instance in craft´s preview. I can query the entry when using status(null)
but a more elegant way is to use the preview token which is available through the query params. Do you know how I can use the preview token to query an entry which is not enabled yet?
Update: It also looks like I can´t use craft.request.isLivePreview()
to determine if I should use status(null)
or not. On the initial page load it is true, when dynamically loading this via sprig, it returns false in preview
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top GitHub Comments
Hi Ben - Thank you for putting this into a new version!
Since the token param is now being passed down to Sprig components, I would have expected the draft version to appear. If this is not the case then please open a new issue with the steps to reproduce and I’ll take a closer look.