Hello I'm using react router my biggest problem is re-routing the error from invalid queries
Using React-Router, React-query
I've tried using a validator object i was wrapping it across my queries to invalidate any malicious search query from entering query call which was a temp fix but it hurts decoupling and the code is a mess and i cant unravel it.
My code structure is that i have a custom hook called in several components all which are shared by the same searchQuery state so they all update at the same time which is good the problem is some invalid queries needs to be errored and not just silently fail where i tried Using HOC which used the same hook and called the same queries i was trying not to, the thing is I'm using supabase as my backend im not that good at it so I dont have a backend function which i can call to validate the query first as a safe checking layer so my queries are called then not used I mean thats as good as i can explain without showing Idk how to here sry i guess but here is my github link if you could take a look.
https://github.com/Mohamed-Abdelrazeq/react-e-commerce
TLDR. I want to know the best practice to validate search queries and not run my dependant react-queries and if i need the react-query output to invalidate the search query how is it best done in the loader by ensuring query? im still testing trying to figure out the best solution but im kinda in the dark.
Btw I'm using Javascript roast me if you want im still learning.
GitHub
GitHub - Mohamed-Abdelrazeq/react-e-commerce
Contribute to Mohamed-Abdelrazeq/react-e-commerce development by creating an account on GitHub.
0 Replies