My model looks like this:
topics = [{id: 'topic1', notes: ''}]
The notes field is required. I am using the track function in my component, e.g:
model={track('logging.topics[].notes', { id: this.props.topic.id })}.
If I remove the topic1 object via dispatch(actions.remove('logging.topics', 0)), my component tree re-renders fine, and the topic disappears. But! If I then submit the form immediately after the removal, the validation fails. It seems that the required notes field is still kicking around in the form reducer, and its validity
I've poked around with my co-worker, and we think some combination of the following is happening:
1) remove isn鈥檛 revalidating the parent array and the fields above it, causing the form to stay invalid
2) the resetValidity that gets called on control-component鈥檚 unmount, when used with track, is picking the first item in the array, even after its gone
@danielericlee Do you have a simple code example that can accurately reproduce this issue?
Sure, here's a Codepen that demonstrates the problem:
http://codepen.io/danielericlee/pen/PWyvEx
To reproduce, click on 'REMOVE FIRST TOPIC' and then click on 'SUBMIT'. In the console, you'll see that the submission failed despite there being no controls left on the page to validate.
BUT! I think I figured this out. It looks like this bug if fixed in RRF version 1.5.1. (My Codepen above is using 1.5.0, as does the app I'm developing against).
Sorry to bother you with this one, in the future I'll try to put together a Codepen if/when I file more Issues 馃槃
Awesome! I'll make a starter CodePen to make it easier for people to recreate issues.