Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

[react-form] reset dynamic list #1837

Closed
wants to merge 1 commit into from
Closed

Conversation

sylvhama
Copy link
Contributor

Description

Fixes #1830

Inspired by #1828

Type of change

It does a full reset of a dynamic list instead of resetting each existing field.
So items that have been removed will reappear and items that have been added will disappear.

  • react-form Patch: Bug (non-breaking change which fixes an issue)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above (Documentation fix and Test update does not need a changelog as we do not publish new version)

@sylvhama sylvhama requested a review from a team April 13, 2021 19:18
@sylvhama sylvhama marked this pull request as draft April 13, 2021 19:18
Comment on lines -72 to +76
dispatch(resetAction({target}));
if (state.isDynamic) {
dispatch(resetListAction());
} else {
dispatch(resetAction({target}));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Problem with this: it will reset the whole list for each item :/ Maybe we could find a better way to avoid performances caveats?

Copy link
Contributor

@oluwatimio oluwatimio Apr 13, 2021

Choose a reason for hiding this comment

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

I dont think we should do this because it means you will not be able to reset individual items if you are using a dynamic list. Also I feel like that would be taking away some functionality that might break flows for people already using DynamicList

@sylvhama sylvhama closed this Apr 13, 2021
@BPScott BPScott deleted the react-form-reset-dynamic-list branch May 22, 2021 00:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useDynamicList does not make the form dirty and has reset issues
2 participants