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

Fix <ArrayInput> adds previously removed item #8029

Merged
merged 3 commits into from Aug 4, 2022

Conversation

djhi
Copy link
Contributor

@djhi djhi commented Aug 3, 2022

Fixes #7385

label="CustomLabel"
defaultValue="default@marmelab.com"
/>
</SimpleFormIterator>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also include an input with no default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

);

// add field and call the onClick event of the button passed as addButton prop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this part?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it was unnecessary and actually induced an issue by adding an item twice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll break in the case where the developer passed a custom add button. If there is a double add, you should probably remove the one in AddItemButton instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored

);

// add field and call the onClick event of the button passed as addButton prop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll break in the case where the developer passed a custom add button. If there is a double add, you should probably remove the one in AddItemButton instead.

@fzaninotto fzaninotto merged commit e36ef26 into master Aug 4, 2022
@fzaninotto fzaninotto deleted the fix-array-input-adding-previously-removed-item branch August 4, 2022 18:30
@fzaninotto fzaninotto added this to the 4.2.6 milestone Aug 4, 2022
@fzaninotto fzaninotto changed the title Fix ArrayInput Adding Previously Removed Item Fix <ArrayInput> adds previously removed item Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding an item to ArrayInput on Edit after removing one brings back the same item that was removed
3 participants