Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Bugfix on with-callback-on-change for a non-update after a first update on props. #30

Merged

Conversation

ivportilla
Copy link

Surely you can notice the bug when you look at the code update, but i will illustrate the bug:
Component with props { a: 1, b: 2 }
-> setProps on Component to { a: 2, b: 2 }
-> setProps on Component to { a: 2, b: 3 }

The callback should have been called only one time (a: 1 -> a: 2), but it is actually being called 2 times.

Commit notes:

  • Updated with-callback-on-change HOC to update the new state, so when the prop is not updated after a first update it works as expected.
  • Added test in order to cover this bugfix.

…n the prop is not updated after a first update it works as expected.

- Added test in order to cover this bugfix.
@codecov
Copy link

codecov bot commented Sep 2, 2019

Codecov Report

Merging #30 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #30   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          17     17           
  Lines         242    243    +1     
=====================================
+ Hits          242    243    +1
Impacted Files Coverage Δ
packages/with-callback-on-change/src/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da662e9...4a40221. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Sep 2, 2019

Codecov Report

Merging #30 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #30   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          17     17           
  Lines         242    243    +1     
=====================================
+ Hits          242    243    +1
Impacted Files Coverage Δ
packages/with-callback-on-change/src/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da662e9...4a40221. Read the comment docs.

@deepsweet deepsweet merged commit e53ac58 into deepsweet:master Sep 2, 2019
@deepsweet
Copy link
Owner

Thanks! Published as [email protected].

@ivportilla ivportilla deleted the bugfix/with-callback-on-change branch September 3, 2019 13:59
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.

2 participants