T
TanStack11mo ago
deep-jade

Blog post reviews requested

I made a blog post about using Angular query in route guards. @arnoud or anyone who is willing, can you take a look and make sure it is factually correct?
6 Replies
quickest-silver
quickest-silver11mo ago
Hi, yeah I can do that
deep-jade
deep-jadeOP11mo ago
DEV Community
Angular Query in route guards
Short version Use queryClient.fetchQuery(...), which returns the data as a...
quickest-silver
quickest-silver11mo ago
Coincidently at my current project we just made a route guard using Query ourselves
deep-jade
deep-jadeOP11mo ago
Nice! It may be a good idea to add an example in the documentation.
quickest-silver
quickest-silver11mo ago
I will take a more in depth look later, but we choose to use ensureQueryData Yes, if you'd want to do that would be great Hi, reviewed it. Good article! I do not have much feedback, maybe a tiny one: change staleTime in the first code snippet to 30_000 and mention in a comment that it should be greater than 0. I’ve seen people confused when they copy / paste a code snippet and it doesn’t work right away. I like how you mention that injectQuery works great for components and not for route guards. This is indeed how it should be used. Also cool to see the pattern of returning queryOptions from a service in your article.
deep-jade
deep-jadeOP11mo ago
Thanks for the review! That is updated now. And thank you for your encouraging words.

Did you find this page helpful?