T
TanStack13mo ago
conscious-sapphire

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
conscious-sapphire
conscious-sapphire13mo ago
Hi, yeah I can do that
conscious-sapphire
conscious-sapphireOP13mo ago
DEV Community
Angular Query in route guards
Short version Use queryClient.fetchQuery(...), which returns the data as a...
conscious-sapphire
conscious-sapphire13mo ago
Coincidently at my current project we just made a route guard using Query ourselves
conscious-sapphire
conscious-sapphireOP13mo ago
Nice! It may be a good idea to add an example in the documentation.
conscious-sapphire
conscious-sapphire13mo 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.
conscious-sapphire
conscious-sapphireOP13mo ago
Thanks for the review! That is updated now. And thank you for your encouraging words.

Did you find this page helpful?