#if 404 not found empty response but react query still showing old data
26 messages · Page 1 of 1 (latest)
Does your queryFn return undefined when you 404?
I'm not sure that helps. Idk what response.data could be or if you even reach there in an error. My initial hunch was you were returning undefined which doesn't work, it has to use null (it should warn you)
haven't recieved any warnings. returning the response data only . let me check if that's undefined or nah
@brazen estuary so the api response is this and 404 status. I am console loging response.data and it's showing the old data from 200 status
You put that console.log in that getTraderStrageties function before the return?
yeah here
This sounds like something is fishy with your API server/client code
If you get the old data there that's not any doing of RQ
api is fine giving correct response. maybe axios problem!
I think need to put try catch inside my getTraderStrategies hmm
and return null on catch
Not sure you're even throwing an error to catch based on what you're saying
If you get to the console.log after the get() call to axios, then it sounds like it didn't error
if I reload the page it's goes away and work. but not real time
lol it's working after putting the try catch
ig axios problem
Well at least that's progress, sorry I wasn't more help
it's ok. doing this conversation helped
@brazen estuary instade of returning null is there any promise I can return that also works
ig undefined dosen't work
Yeah you can't return undefined from a queryFn. You either need to return null or throw an Error