Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Enforce an object return from selectFromResult #216

Merged
merged 4 commits into from
Apr 18, 2021

Conversation

markerikson
Copy link
Collaborator

@markerikson markerikson commented Apr 18, 2021

This PR:

  • Updates the TS types to ensure that selectFromResult always returns an object, not a primitive
  • Fixes deletion of the build folder to work cross-platform
  • Fixes up formatting

I'd found a lovely edge case in my own app where I had:

selectFromResult: (res => res?.items?.length ?? 0)

Unfortunately, due to how the result stuff gets merged together later, I ended up with number & BunchOfResultData, which is of course not valid at all. I had to ensure that I returned the value inside an object.

So, now we enforce that at the type level too.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 18, 2021

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 35504ca:

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

@netlify
Copy link

netlify bot commented Apr 18, 2021

Deploy preview for rtk-query-docs ready!

Built with commit 35504ca

https://deploy-preview-216--rtk-query-docs.netlify.app

@github-actions
Copy link

github-actions bot commented Apr 18, 2021

size-limit report 📦

Path Size
ESM full 10.15 KB (0%)
ESM full (React) 11.56 KB (0%)
createApi + setupListeners 9.19 KB (0%)
createApi (React) + setupListeners 10.46 KB (0%)
fetchBaseQuery 701 B (0%)
retry 278 B (0%)
ApiProvider 400 B (0%)
CJS minfied 15.67 KB (0%)
CJS React minfied 17.37 KB (0%)

@markerikson markerikson merged commit 5fedbc9 into next Apr 18, 2021
@markerikson markerikson deleted the feature/select-result-types branch April 18, 2021 23:17
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.

1 participant