Fix global config animation durations being ignored if props are not set #71
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.
This will fix an issue where if the animation durations are set in the global config, they are ignored unless an explicit prop is passed.
The problem is that the current implementation does a simple logical OR comparison against the config value if the prop value is undefined, meaning it falls back to 100 ms for the duration of the animation.
Sample code that used to cause the issue:
Component usage:
The fix is to just use the Nullish coalescing operator to compare the values rather than only checking if props set it to zero. So now the priority is props value -> config value -> default (100) as intended.
I've already tested this change in my current project, as well as the example project and it works correctly as far as I can see now.