Last active
September 18, 2019 01:42
-
-
Save peterknolle/3780412dd47d8c0383a56a4858a53715 to your computer and use it in GitHub Desktop.
Shows the lightning-input-field not working after user input. (1): Click the button and see the lightning-input-field get updated. (2) Manually type something into the lightning-input-field and see it change. (3) Go back and click the button and see the update no longer work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-record-edit-form | |
object-api-name="Account"> | |
<lightning-input-field | |
field-name="Name" value={name}></lightning-input-field> | |
</lightning-record-edit-form> | |
<lightning-button label="Click to change name" variant="brand" onclick={handleClick}></lightning-button> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, track } from 'lwc'; | |
export default class Example extends LightningElement { | |
@track name = 'a'; | |
handleClick() { | |
this.name = this.name + 'a'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is working as designed. From the lightning-input-field documentation:
Why wouldn't it also be assumed that user input collected from a lightning-input are unsaved changes that should not be overwritten? Seems totally arbitrary and a pain that we've lost the metadata-aware lightning-input-field.