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

Form element @value argument is not rendered as initial value of form control #1403

Closed
lindyhopchris opened this issue Jan 20, 2021 · 5 comments · Fixed by #1406
Closed

Form element @value argument is not rendered as initial value of form control #1403

lindyhopchris opened this issue Jan 20, 2021 · 5 comments · Fixed by #1406
Labels

Comments

@lindyhopchris
Copy link
Contributor

Upgrading from Ember Bootstrap 4.4.0 to 4.6.1, the @value argument on <BsForm::Element> is no longer set as the form control value when the control is initially rendered.

Looking at the code, in 4.4.0 the _value property of the component was decorated with @defaultValue.
https://github.com/kaliber5/ember-bootstrap/blob/19ded7030e6de572521595e026bdad7c955381ec/addon/components/bs-form/element.js#L296-L297

In 4.6.1 it is decorated with @tracked. However there is nothing that is setting the initial value of _value, so whatever you provide via @value is not rendered.
https://github.com/kaliber5/ember-bootstrap/blob/fdcd8ee53586b6611278c0607b4f68f9638ec683/addon/components/bs-form/element.js#L278

@lindyhopchris
Copy link
Contributor Author

PR adds a failing test - I noticed the form-element tests had no existing tests for @value.

I'm happy to update the PR with a fix, but just need to know how this should be fixed? I'm not sure whether it should just be switched back to @defaultValue, or whether some other change is required?

@simonihmig
Copy link
Contributor

Thanks for reporting, and submitting that test, which is helpful! 👍

That @defaultValue was responsible for some backwards compatibility in the old Ember.Components world, but it did not magically listen to @value. I need to get a closer look at what's going wrong there...

@jelhan
Copy link
Contributor

jelhan commented Jan 20, 2021

Thanks a lot for reporting this. It was broken by #1339. But not by removing the @defaultValue decorator but due to the differences of @glimmer/component and @ember/component itself. Should be fixed by #1406.

@lindyhopchris
Copy link
Contributor Author

No problem, thanks both for looking into it!

@simonihmig
Copy link
Contributor

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 a pull request may close this issue.

3 participants