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

Append to array when key is "-" #872

Merged
merged 2 commits into from Nov 24, 2021
Merged

Append to array when key is "-" #872

merged 2 commits into from Nov 24, 2021

Conversation

lourd
Copy link
Contributor

@lourd lourd commented Nov 18, 2021

Closes #871

It's actually amazing '-' was doing anything at all! Definitely a JS quirk that the first argument to splice is coerced to a number, effectively becoming 0 if the parameter can't be parsed.

I also dropped an unnecessary any cast, and added a check for avoiding an unnecessary copy of the patch array.

@netlify
Copy link

netlify bot commented Nov 18, 2021

✔️ Deploy Preview for quizzical-lovelace-dcbd6a canceled.

🔨 Explore the source changes: fe80e02

🔍 Inspect the deploy log: https://app.netlify.com/sites/quizzical-lovelace-dcbd6a/deploys/6195aa639e7cde0007f4a814

@lourd lourd changed the title Appends to array when key is "-" Append to array when key is "-" Nov 18, 2021
@lourd
Copy link
Contributor Author

lourd commented Nov 21, 2021

Please me know if there's I can do to help push this along! Tests are passing for me locally on Node.js v12 and v14; looks the failures on v16 are unrelated.

@mweststrate mweststrate merged commit 2afdb1b into immerjs:master Nov 24, 2021
@github-actions
Copy link
Contributor

🎉 This PR is included in version 9.0.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lourd lourd deleted the fix/array-append branch November 24, 2021 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appending to array using patch inserts element at beginning of array instead of the end
2 participants