fix(moveFieldState): get change/blur/focus callbacks from oldState#54
fix(moveFieldState): get change/blur/focus callbacks from oldState#54SeqviriouM wants to merge 3 commits into
Conversation
Codecov Report
@@ Coverage Diff @@
## master #54 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 159 159
Branches 34 34
=========================================
Hits 159 159
Continue to review full report at Codecov.
|
|
@erikras can you check, please? |
| const incrementedKey = `${name}[${fieldIndex + 1}]${tokens[2]}` | ||
| moveFieldState(state, backup[key], incrementedKey) | ||
| moveFieldState(state, backup.fields[key], incrementedKey, backup) |
There was a problem hiding this comment.
@SeqviriouM Found your PR while was trying to resolve issues with insert.
Tested this code in app, where I have issues with insert and it didn't work well. Deeply nested fields handlers are messed up, so changing value in one field changes value in another one(I think because of moving handlers). What helped me is just:
delete state.fields[key]
So all fields after inserted one get default state and handlers.
Previously in function
moveFieldStatecallbackschange/blur/focusis requested by newdestKey. But I think it will be more correct to save previous callbacks. For example, when I remove second value from array I will expect it will also remove second callback with it. So I have tuned a bit test cases. It should fix issues #49 #51.What do you think about this changes?