-
-
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
pass the ThunkArg to the idGenerator function #1600
Conversation
✔️ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: 56ec553 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/616bce893db31400082416a9 😎 Browse the preview: https://deploy-preview-1600--redux-starter-kit-docs.netlify.app |
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 56ec553:
|
Sorry that I got back to this so late - I'm completely swamped at the moment. This looks good - can you also add docs changes and a test maybe? |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
This allows you to generate requestIds based on the extra argument.
While working on a global error handling reducer where i needed to generate a unique ID for each outgoing
request, there were cases where the url itself changes based some parameters so the final url looks something
like this:
https://...../users/${ID}/add-to-favorite
and if, say you want to spin a loader for a specific item in a list of let's say 10 paginated items, you will actually
need to somehow uniquely identify which request belongs to which item, but if you could pass the thunkArg to
the request generator function you can easily then generate requestIds based on it, so that when you call
the idGenerator with a given id, it produces a "hash-like" representation of it.