question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query entries in preview with token within sprig request

See original GitHub issue

Question

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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
alococommented, Oct 7, 2021

Hi Ben - Thank you for putting this into a new version!

0reactions
bencrokercommented, Oct 27, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Cloud Gateway
Clients make requests to Spring Cloud Gateway. ... The Query route predicate factory takes two parameters: a required param and an optional regexp...
Read more >
Authorize API Requests with Bearer Token in Postman
Learn how to authorize your API Requests using the Bearer Token Authorization. We will be using the GitHub API for this video.
Read more >
Execute a SOQL Query | REST API Developer Guide
Use the Query resource to execute a SOQL query that returns all the results in a single response, or if needed, returns part...
Read more >
Spring Method Security with PreAuthorize - Okta Developer
This annotation contains a Spring Expression Language (SpEL) snippet that is assessed to determine if the request should be authenticated.
Read more >
Spring Security With Okta - Baeldung
Also, make sure to mark Authorization code for the Grant type allowed, required to enable OAuth2 authentication for a web application. 2.5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found