-
Notifications
You must be signed in to change notification settings - Fork 649
form.key inside arrays #870
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
Comments
And it has more weird behavior when in arrays in objects. Plunker updated to demonstrate. |
@mnzaki Because it doesn't know the key it can't replace it with the index. |
I updated the plunker to reflect that, but now the empty string gets replaced with |
Also the behavior of |
@mnzaki I'll take a look tonight, I see the issue as described now thanks :) |
I have been looking at code, and there seems to be a few problems. If so then in |
@mnzaki right, makes sense, I didn't get a chance the other night, wife dragged me out shopping, very much against my will, will definitely take a look this weekend. |
More analysis: Another related problem is in this line in scope.initialForm = Object.assign({}, sfSchema.lookup['f' + attrs.sfField]);
/*->*/ scope.form = sfSchema.lookup['f' + attrs.sfField]; Assigning the form object directly from the Changing this to the (IMHO) correct behavior of copying the item each time unfortunately causes breakage in certain areas that depend on the side-effect of I think that in a best case scenario this should not be supported (ie, making changes and not firing Also note the tests I just pushed and PRed, I purposefully left out the form object everywhere (so that the default is generated) as that triggers broken |
@Anthropic I think I broke something with the fixes related to this issue, please take a look at the test I just added here. When deleting items from an array of objects it deletes other items as well. The bug is triggered when the form object has a "fieldset" (as opposed to the object items directly referenced in the array form object items) |
Thanks, I am hoping to get some time this week to fix up some of the smaller issues like this. Thanks for the update. |
@Anthropic please do take a look at #895 which adds a test and a fix for the issue I just mentioned. |
@mnzaki The should not delete innocent items on delete test is failing, can you take a look at what would be causing that? |
@Anthropic that's again the same issue because I did not commit |
Ah yes, you even added a comment on it to that effect, sorry about that! |
@mnzaki sat down at my home pc and immediately realised I couldn't sync latest changes as I had the build fix uncommitted, got one bug to fix then I should be able to push it. |
Merged :) |
Bug
form.key
inside arrays appends the array path and empty string""
after the actual key, for example giving["names", 0, "names", ""]
for the first array item in an array with key["names"]
.Gist/Plunker/Demo
Plunker demonstrating the issue
@json-schema-form/angular-schema-form-lead
The text was updated successfully, but these errors were encountered: