Closed nouman91 closed 1 year ago
We just use the built-in fetch
API. I have no idea how Safari's overrides work, but I don't think it's going to be anything we have control over in RTKQ.
Hmm.. Thank you for your quick reply. It seems I have to do some digging around to understand it.
Brief description Safari local override: You can override the response returned by the server with whatever you want and instead of serving the server response it will serve you the local response. Override
I just did a quick test: API-1 with rtk query; Does not work with local override always returns the original cached server response. API-2 without rtk query: Works as expected with local override.
as in, making a normal fetch
request returns your override?
edit: I just reread
RTKQ intentionally returns the cached result, that's what a cache does. If you want to clear the cache when you apply an override then you might need to dispatch resetApiState,
Thank you! I think that's what I need in this case as data is cached. Looking into integrating resetApiState for my use case.
Is there any way I can disable the cache completely?
RTK Query is the cache, it doesn't do a lot beyond that. So, removing RTK Query would do that. But honestly, if you don't manually persist your Redux store somewhere: press F5 and you start again with an empty cache.
Closing this issue as it was related to caching. Thanks for the quick help, I really appreciate it.
Hi, I am trying to override the server response with local override and I have noticed it does not work with RTK query. My use case is the server does not have the data and I want to load data with Safari local override. But the trouble is RTK query can't seem to understand it and does not return the overridden data.
I am sure this has been answered somewhere but I was not able to find it.