Web Dev CodyW
Convex Community2y ago
10 replies
Web Dev Cody

Question about Error

I have a page in react which does a useQuery(api.stories.getStory), and I also have a button on that page which deletes that story resource. I'm seeing an issue where after I delete the resource, I have logic to redirect back to another page, but the useQuery seems to fire before the redirect finished and causes the app to throw an error.

Does anyone have a pattern I can use to prevent this type of issue? The only approach I know of it to never have queries throw errors, and instead just have them return null or undefined or something
Was this page helpful?