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

immer 3.0 #309

Merged
merged 27 commits into from Apr 17, 2019
Merged

immer 3.0 #309

merged 27 commits into from Apr 17, 2019

Conversation

mweststrate
Copy link
Collaborator

@mweststrate mweststrate commented Feb 3, 2019

@coveralls
Copy link

coveralls commented Feb 3, 2019

Coverage Status

Coverage remained the same at 99.726% when pulling 1f056dc on immer3 into 42b14bd on master.

@aleclarson
Copy link
Member

As I've said in #246, I'm highly against ignoring the return value by default. The current behavior is much better, and I think the void trick should be discouraged in the docs, since it's just a footgun for no real gain. If anything, the return value should always be used so the mental model is closer to a traditional reducer. In the end, there's really not a strong enough justification for changing the current behavior at all.

@alitaheri

This comment has been minimized.

@mweststrate

This comment has been minimized.

@aleclarson aleclarson changed the title WIP: immer 3 immer 3.0 Feb 25, 2019
@aleclarson
Copy link
Member

I'll review this today, too. (New York timezone)

Can you reword the commit messages to fit the Conventional Commits style?

@aleclarson
Copy link
Member

Also, I'm a little worried about the changes to the flow types, considering this comment. Maybe it would be best to leave the flow types alone, or remove them entirely?

@migueloller
Copy link

@aleclarson, I agree with your sentiment. The general intent of the changes I proposed are in the right direction, I think, but unless a newer version of Flow fixed a few things there were some issues with those Flow types.

This is nothing that can't be tested, though. So if all the Flow tests are passing, and we should make sure they're not false positives, it should be alright. Perhaps adding some more Flow tests could help as well?

If this is a change that you guys really want to get in for v3 maybe I can set aside some time to look into it this week.

@mweststrate
Copy link
Collaborator Author

@migueloller, ah misunderstood the latest commits, thought that they addressed the open issues. Will revert this change (we can also merge it in later).

I peeked in more detail at your changes, at least they are partially incorrect: produce (uncurried) always produces S, not R! Same for the curried function, that also produces S. The recipe itself can indeed, in both cases, either return S | void.

@mweststrate
Copy link
Collaborator Author

@aleclarson sorry, I really should make that a habit! Rebasing...

@mweststrate
Copy link
Collaborator Author

eh lol, I'll try again

@mweststrate
Copy link
Collaborator Author

Note: build is currently not being executed due to the repo transfer. It didn't sync to travis yet....

@migueloller migueloller mentioned this pull request Apr 15, 2019
@migueloller
Copy link

@mweststrate,

I peeked in more detail at your changes, at least they are partially incorrect: produce (uncurried) always produces S, not R! Same for the curried function, that also produces S. The recipe itself can indeed, in both cases, either return S | void.

That is correct. I made a mistake when writing these types to assume the issue I was trying to fix was because the return type of the recipe was S | void when really the issue was that because the type of a Redux reducer is (RS | void, A) => RS, immer was inferring S as RS | void.

I think the solution to this problem is proper use of type variance.

.travis.yml Outdated
@@ -18,7 +17,7 @@ script:
- yarn coveralls
- yarn test:flow
- yarn test:dts
- yarn add typescript@3.3 -D && yarn test:dts
- yarn add typescript@latest -D && yarn test:dts
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should test typescript@next too (or instead), for early heads up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'll revert it to 3.4, some hardcoded versions. TS is quite aggressive with their latest tag, and having random build failures is annoying. It is not the CI's responsibility to test compatible with random TS versions and gives us heads ups. The point is to make sure we didn't break anything ourselves

@aleclarson
Copy link
Member

LGTM! 👍

I simplified the IProduce type tests (see here). :)

@mweststrate
Copy link
Collaborator Author

@aleclarson. Lol, thanks for doing the obvious thing :)

@mweststrate mweststrate merged commit e6b0e52 into master Apr 17, 2019
@@ -734,10 +735,18 @@ Most important observation:

## Migration

**Immer 2.\* -> 3.0**

TODO
Copy link
Member

Choose a reason for hiding this comment

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

Whoops ;)

Copy link
Member

Choose a reason for hiding this comment

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

I cancelled the deploy for you 👍

@mweststrate
Copy link
Collaborator Author

mweststrate commented Apr 17, 2019 via email

@aleclarson
Copy link
Member

@mweststrate Did you see my review comment about the migration guide?

@mweststrate
Copy link
Collaborator Author

@aleclarson ehh nope. I have to leave currently. Would you mind triggering a 3.0 release, and updating migration guide if needed? I didn't figure out how to trigger a major release with semantic-release yet.

@aleclarson
Copy link
Member

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@aleclarson
Copy link
Member

The BREAKING CHANGE part goes in the footer 😛

@mweststrate
Copy link
Collaborator Author

mweststrate commented Apr 17, 2019 via email

@aleclarson aleclarson deleted the immer3 branch April 18, 2019 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants