Fix rescan bug and implement getDirtyFields #131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@codedance
Changes
Rescan Bug
Rescan shouldn't be recalculating the original value when the original value is actually an empty string.
My use case that came across this (IMO) bug:
Dynamic form. Add a new blank field to be filled out. Run rescan, which correctly sets the original value of the field to empty string. Then fill in the field, yay it's dirty. Then I add another field. This time rescan incorrectly changes that first field's original value to what I've typed so. Oh no, form suddenly not dirty anymore.
Exposing
getDirtyFieldsAlso needed some functionality to keep my code cleaner. looks like this was asked for in issue #74. So here's my take on that, too.
You can now get the dirty fields:
Just adds a data value
dirtyFIeldsin which the array of dirty fields is added.