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

Upgrade immer to 7.0.0 #3850

Merged
merged 1 commit into from
Jan 15, 2021
Merged

Conversation

aiwenar
Copy link
Contributor

@aiwenar aiwenar commented Aug 31, 2020

Is this adding or improving a feature or fixing a bug?

Upgrading a dependency.

What's the new behavior?

Hopefully none.

I'm proposing this upgrade because I've run across immerjs/immer#559, a fix for which is included in immer >= 6.0.4. This issue does not occur in Slate itself (hence why I didn't mark this PR as fixing a bug), but rather when a Slate type such as Range is stored in an immer-controlled container, and transformed. For example this:

let state = {
    anchor: { path: [0, 0], offset: 0 },
    focus: { path: [0, 0], offset: 10 },
}

state = produce(state, s => Range.transform(s, { type: 'insert_text', path: [0, 0], offset: 5, text: 'new' }))

will result in state.focus.path being a revoked proxy.

Since this changes a major version of a public dependency it is also a breaking change in Slate. However, I have verified that Slate works with Immer 5, 6, and 7, so in theory we could accept immer >= 5.00 < 8.0.0 and let the consumer choose which version of Immer they want, thus avoiding a breaking change. I'm not proposing that in this PR as I don't know how to do that in npm.

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)

Does this fix any issues or need any specific reviewers?

Fixes:
Reviewers:

@BrentFarese
Copy link
Collaborator

It looks ok to me. The 1 thing I worry about is the test coverage in core not covering all areas and some issue with freezing some portion of the editor state creeping up, or some other Immer issue. But in general, I think we should upgrade this dependency. It is a major dependency tho.

@BrentFarese
Copy link
Collaborator

Glad to merge this in @aiwenar if you can clean up the conflicts and get it passing CI? Thanks!

@aiwenar
Copy link
Contributor Author

aiwenar commented Jan 15, 2021

Sure. Would you prefer me to merge master into this branch, or rebase this branch on master?

@BrentFarese
Copy link
Collaborator

Sure. Would you prefer me to merge master into this branch, or rebase this branch on master?

Either works for me. Thanks!

@aiwenar
Copy link
Contributor Author

aiwenar commented Jan 15, 2021

Squashed and rebased on top of master, otherwise unchanged. Since this PR was opened immer released versions 7.0.15 and 8.0.0, but I've left it at 7.0.7 as this is the version I've used when I opened this PR.

@BrentFarese BrentFarese merged commit 79e02e8 into ianstormtaylor:master Jan 15, 2021
@BrentFarese
Copy link
Collaborator

Fixes #4034.

@niieani
Copy link

niieani commented Jan 17, 2021

@BrentFarese Any ETA on when we can expect a next beta containing this to be released? I'd love to be able to make use of the new TypeScript improvements, but cannot since the last one out (0.61) is broken due to #4034.

Many thanks for your help! 🙇

@BrentFarese
Copy link
Collaborator

@BrentFarese Any ETA on when we can expect a next beta containing this to be released? I'd love to be able to make use of the new TypeScript improvements, but cannot since the last one out (0.61) is broken due to #4034.

Many thanks for your help! 🙇

No exact ETA but hope to release something shortly so this issue gets resolved on the @next release.

@williamstein
Copy link

williamstein commented Jan 19, 2021

I can confirm that @next is updated, and with that update, which includes this PR, #4034 is fixed for me. Thanks! And I just successfully migrated my codebase over to use the new Typescript support.

@gitcatrat gitcatrat mentioned this pull request Jan 19, 2021
lukesmurray pushed a commit to lukesmurray/slate that referenced this pull request Feb 5, 2021
clauderic pushed a commit to slate-rte/slate that referenced this pull request Mar 16, 2021
clauderic pushed a commit to slate-rte/slate that referenced this pull request May 3, 2021
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 this pull request may close these issues.

Error when deselecting or pasting: Cannot add property 0, object is not extensible
4 participants