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

Svelte 3.24.0 seems to have broken input value binding #157

Closed
d0x2f opened this issue Jul 8, 2020 · 8 comments
Closed

Svelte 3.24.0 seems to have broken input value binding #157

d0x2f opened this issue Jul 8, 2020 · 8 comments

Comments

@d0x2f
Copy link

d0x2f commented Jul 8, 2020

With two input fields in the same component, changing one seems to clear the others.

See this REPL for an example: https://svelte.dev/repl/a3a78cc7744b4b4fb4a1b4a752e9a2d3?version=3.24.0

There are a couple of <input> related PRs included in svelte 3.24.0:

@bestguy
Copy link
Owner

bestguy commented Jul 12, 2020

Yikes that's nasty, thanks for the heads up @d0x2f . There's some delay with response due to covid situation, but catching up here, is a general fix forthcoming with svelte, or does this call into question our usage of $$props?

@valent-novem
Copy link

Edit Input.svelte, replace line 27 with this:
const { type: _omitType, color: _omitColor, value: _omitValue, ...props } = clean($$props);
Seems like it will fix the problem

@bestguy
Copy link
Owner

bestguy commented Jul 12, 2020

Thanks, let me try this out and look for other instances

@d0x2f
Copy link
Author

d0x2f commented Jul 13, 2020

Thanks @bestguy,

To your original question, I'm not too certain on what the behaviour of the proposed svelte PR will have in this case, I'm not familiar enough with the svelte code to tell.

A svelte dev mentioned the relatively new $$restProps var, which is the same as $$props but omits any keys that are exported by the component.
So in this case, since 'value' is exported, $$restProps will omit it by default.

This seems like the right approach to me.

@bestguy
Copy link
Owner

bestguy commented Jul 13, 2020

relatively new $$restProps var, which is the same as $$props but omits any keys that are exported by the component.

Nice! that $$props omit stuff was a pain

@bestguy
Copy link
Owner

bestguy commented Jul 13, 2020

An update is moving to $$restProps seems to clear issue, but 3.24.0 also breaks Inputs type="select" altogether, I need to correct that prior to merge.

@bestguy
Copy link
Owner

bestguy commented Jul 15, 2020

Hey @d0x2f , this should be corrected in [email protected], please update/close this issue if corrects for you.
Thanks for the heads-up

@d0x2f
Copy link
Author

d0x2f commented Jul 15, 2020

Thanks so much @bestguy, it works great. The REPL is fixed now as well.

🍻

@d0x2f d0x2f closed this as completed Jul 15, 2020
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

No branches or pull requests

3 participants