-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add baseQueryMeta to thunks, meta to lifecycle results #1084
Conversation
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 dcd4c8d:
|
Size Change: +1.97 kB (0%) Total Size: 532 kB
ℹ️ View Unchanged
|
✔️ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: dcd4c8d 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/60b6a0dcb0f7700008d6f524 😎 Browse the preview: https://deploy-preview-1084--redux-starter-kit-docs.netlify.app |
Yes I'm using TypeScript and seems the parts relying on createAsyncThunk are having type errors now. Specifically in extraReducers where I'm using |
@TamasSzigeti very valuable feedback, thank you. I will look into that & add a test for it. |
@TamasSzigeti I have added a test for that over at 64a8c64#diff-a11e9f94b91b0761740b0b3daf0f10c2b45a1881e554e229914dc23d146826e1R104 but I cannot really reproduce that behaviour. Can you please create a reproduction? |
@phryneas I trimmed down my case, and it seems that the unknown payload comes about when I pass a second argument to the payloadCreator, whether I want to use https://gist.github.com/TamasSzigeti/2ddade02d2e647d25d8810da04dba494 |
64f547a
to
c0f2848
Compare
Thank you @TamasSzigeti ! Thanks for the report 👍 😃 |
c0f2848
to
6321a8a
Compare
size-limit report 📦
|
Nice, thank you! My case works perfectly having re-implemented it with
|
Yup, the types will be the next step :) Thanks for validating! |
`meta.arg.startedTimeStamp` -> `meta.startedTimeStamp` `payload.fulfilledTimeStamp` -> `meta.fulfilledTimeStamp` `payload.result` -> `payload`
6321a8a
to
5f6d2e1
Compare
Aaand we have types. |
Awesomeness, and it works perfectly, same types as with onSuccess before. One thing that might worth adding to the docs is a note about when can the meta come through as undefined. I guess it has to do with an overridden queryFn? Thanking muchly, this is becoming nice and clean, very pleasant to work with. |
@TamasSzigeti Those are always optional because I did not want to add multiple generic arguments here for something that is more of an "edge case" use. In the case of |
@phryneas Thanks, my interpretation was correct then. My point is that this could be useful to be added in the docs. |
This contains #1083 and is a definite WIP, just want to see if it works for #1080
@TamasSzigeti could you give the CodeSandbox build of this a spin? Types are still missing, but
meta
is on there, so you might have to do anany
-cast to get it out there atm. if working with TSInstall instructions at https://ci.codesandbox.io/status/reduxjs/redux-toolkit/pr/1084/