rtk-incubator / rtk-query

Data fetching and caching addon for Redux Toolkit
https://redux-toolkit.js.org/rtk-query/overview
MIT License
626 stars 31 forks source link

also call provides/invalidates in error cases #180

Closed phryneas closed 3 years ago

phryneas commented 3 years ago

This adresses #170.

It is at the moment of writing a breaking change as it changes the signature of invalidates/provides from (result, args) => Entities to (result?, error?, args) => Entities.

It only triggers on handled errors, which means a simple throw in the baseQuery would pass by this, only an error returned by returning { error: ... } from baseQuery would lead to this.

codesandbox-ci[bot] commented 3 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 28591193a9f94e3162ed2cfba359c56a1613f8d8:

Sandbox Source
React Configuration
React Typescript Configuration
rtk-query-demo Configuration
svelte-app-rtk-simplequery-demo Configuration
github-actions[bot] commented 3 years ago

size-limit report 📦

Path Size
ESM full 9.85 KB (+0.91% 🔺)
ESM full (React) 10.95 KB (+0.98% 🔺)
createApi + setupListeners 8.99 KB (+1.2% 🔺)
createApi (React) + setupListeners 9.96 KB (+1.11% 🔺)
fetchBaseQuery 661 B (0%)
retry 271 B (0%)
ApiProvider 400 B (0%)
CJS minfied 15.21 KB (+0.5% 🔺)
CJS React minfied 16.46 KB (+0.42% 🔺)
msutkowski commented 3 years ago

Mergged in #201