Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

also call provides/invalidates in error cases #180

Closed
wants to merge 1 commit into from

Conversation

phryneas
Copy link
Collaborator

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
Copy link

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 2859119:

Sandbox Source
React Configuration
React Typescript Configuration
rtk-query-demo Configuration
svelte-app-rtk-simplequery-demo Configuration

Comment on lines +27 to 31
type GetResultDescriptionFn<EntityTypes extends string, ResultType, QueryArg, ErrorType> = (
result: ResultType | undefined,
error: ErrorType | undefined,
arg: QueryArg
) => ReadonlyArray<EntityDescription<EntityTypes>>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up for discussion: instead of going (result, arg) => Entities to (result?, error?, arg) => Entities, we could also go for

  • (arg, result?, error?) => Entities

or

  • ({result, error, arg}) => Entities

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think having the original input last makes sense so it follows the whole acc, curr, array type of signature?

@github-actions
Copy link

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
Copy link
Member

Mergged in #201

@msutkowski msutkowski closed this Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants