-
Notifications
You must be signed in to change notification settings - Fork 2k
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 an empty item when editing an existing Secure Variable #13436
Append an empty item when editing an existing Secure Variable #13436
Conversation
Ember Asset Size actionAs of 10110d3 Files that got Bigger 🚨:
Files that stayed the same size 🤷:
|
Ember Test Audit comparison
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm noticing some lurking errors and warning messages as a result of the save
logic. I have a feeling that setAndTrimPath
shouldn't be running when the form is in edit
mode. We disable the input
field on the client, however, we still run setAndTrimPath
which resets the id
of the model we're currently working on.
This can lead to some nasty side-effects and I get this warning:
WARNING: The 'id' for a RecordIdentifier should not be updated once it has been set. Attempted to set id for 'variable:blue/berkshire/lime (@ember-data:lid-variable-blue/berkshire/lime)' to 'null'.
Now that we're adding a callback that's fired when the form element is appended onto the DOM, we should maybe consider explicitly modeling state.
@@ -1,4 +1,6 @@ | |||
<form class="new-secure-variables" autocomplete="off" {{on "submit" this.save}}> | |||
<form class="new-secure-variables" autocomplete="off" {{on "submit" this.save}} | |||
{{did-insert this.appendItemIfEditing}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking
: The challenge with this logic is that the newly appended row can't be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct; but all empty rows are removed on save.
The point of this PR is so that the "can't be deleted" row is a new empty-by-default one, rather than the last one in the list. cc @juliezzhou
* Did-insert modifier to add an extra row when editing * Defensive logic on model existing * Defensive pattern on copy keyValues
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Resolves #13394
Appends an empty row to the end of your Items array when you modify an existing Secure Variable.
This ensures that all previous rows are deletable, and with #13424, will compact/remove empty items on save.