Skip to content

Fix: each block binding with spread syntax #6883

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

Closed

Conversation

RaiVaibhav
Copy link
Contributor

@RaiVaibhav RaiVaibhav commented Oct 27, 2021

Fixes: #6860
Reason: #6860 (comment)

( this PR target the change in the compiler code to avoid any edge case and additionally during the creation of each block, rest indirectly gets its the value from the array (on which each block will iterate) i.e, child_ctx[3] = object_without_properties(list[i], ["id"]); and here if we change the code inside the object_without_properties and make it mutable then that means the exclude property will be removed from array also.)

Please suggest some other approach also 👍

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with [feat], [fix], [chore], or [docs].
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

@tanhauhau
Copy link
Member

thanks for your changes.

I'd prefer to not support this, and throw an warning / error when trying to bind to a rest object.

using the ...rest operator is supposed to create a new object, and modifying the new object shouldn't propagate the changes back to the original object.

also, the issue itself did not get much attention, i believe this is quite an edge case.

@tanhauhau
Copy link
Member

@RaiVaibhav do u wanna work on a new PR for printing out a warning when trying to bind to a rest object?

@tanhauhau tanhauhau closed this Apr 17, 2022
@RaiVaibhav
Copy link
Contributor Author

Hey @tanhauhau I will work on this, currently having an issue in setting up the svelte locally, I have asked for help in the discord contributing will start on this after local setup

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.

bind inside #each block on destructured value
2 participants