Skip to content
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

Proposal: Use NamedSet everywhere #909

Closed
funwithtriangles opened this issue Apr 14, 2022 · 3 comments · Fixed by #725
Closed

Proposal: Use NamedSet everywhere #909

funwithtriangles opened this issue Apr 14, 2022 · 3 comments · Fixed by #725

Comments

@funwithtriangles
Copy link

NamedSet is a variation of SetState that accepts a third argument for passing in a string, for naming actions. This is used by the devtools middleware to have named logs.

Unfortunately having these two different types for SetState can cause all sorts of problems when chaining middlewares, where that third argument gets lost in the mix, etc.

What's the reason for not just using NamedSet by default? Why can't that optional argument always be there and we can get rid of an entire type? It doesn't always have to be consumed by other middlewares but it should always be passed on

@dai-shi
Copy link
Member

dai-shi commented Apr 14, 2022

Is this an issue only about TypeScript? (If so, v4 will address it.)
Or, do you see any issue with JavaScript without types?

@funwithtriangles
Copy link
Author

funwithtriangles commented Apr 14, 2022

It's about Typescript. What can we expect to change with v4? 🙃

@dai-shi
Copy link
Member

dai-shi commented Apr 14, 2022

We have a few more PRs to be merged before releasing v4.0.0-rc.0.
Meanwhile, you can try #725. https://ci.codesandbox.io/status/pmndrs/zustand/pr/725 👈 Find "Local Install Instructions"

@dai-shi dai-shi linked a pull request Apr 14, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants