admin管理员组文章数量:1389897
I am using:
dispatch(api.endpoints.getPosts.initiate(undefined))
But Im receiving following error inside redux:
name:"ConditionError"
message:"Aborted due to condition callback returning false."
I found the meaning of this error at this question:
It means that an asyncThunk was not executed due to condition. If you are using RTK Query, that just means that another request was skipped because there was either already a request in flight or already a value in cache, so no request needs to be made. This is an internal rejection that RTK-Query uses to track ponent subscriptions and not an error.
But is there any way to force the refetch?
I am using:
dispatch(api.endpoints.getPosts.initiate(undefined))
But Im receiving following error inside redux:
name:"ConditionError"
message:"Aborted due to condition callback returning false."
I found the meaning of this error at this question:
It means that an asyncThunk was not executed due to condition. If you are using RTK Query, that just means that another request was skipped because there was either already a request in flight or already a value in cache, so no request needs to be made. This is an internal rejection that RTK-Query uses to track ponent subscriptions and not an error.
But is there any way to force the refetch?
Share Improve this question edited May 31, 2022 at 18:51 Rashomon asked May 31, 2022 at 15:11 RashomonRashomon 6,8024 gold badges39 silver badges80 bronze badges1 Answer
Reset to default 7Found the solution. You should use {forceRefetch: true}
option:
dispatch(api.endpoints.getPosts.initiate(undefined, {forceRefetch: true}))
本文标签:
版权声明:本文标题:javascript - Any way to force refetch when using endpoint "initiate" function of redux-toolkit - Stack Overflo 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744611661a2615693.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论