Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connectObservable): fix updates when dealing with many component #56

Merged
merged 2 commits into from
Jul 14, 2020

Conversation

voliva
Copy link
Collaborator

@voliva voliva commented Jul 14, 2020

No description provided.

@voliva voliva requested a review from josepot July 14, 2020 16:52
@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #56 into main will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #56   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          246       246           
  Branches        31        33    +2     
=========================================
  Hits           246       246           
Impacted Files Coverage Δ
src/internal/react-enhancer.ts 100.00% <100.00%> (ø)
src/internal/useObservable.ts 100.00% <100.00%> (ø)

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 a3d9dd1...4a87371. Read the comment docs.

const result = new Observable<T>(subscriber => {
let isActive = true
const subscription = source$.subscribe({
next(value) {
if (
isActive &&
value !== (COMPLETE as any) &&
!Object.is(latestValue, value)
!Object.is(initialSyncValue, value)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the cause. latestValue is shared among all subscribers of the same observable, so only the first one would get the value.

This check was added in #54, and IRC it was done for the batch updates test (at least, it's the test that fails if I remove this check)

Copy link
Member

@josepot josepot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks a lot @voliva !

@josepot josepot merged commit 5b5b138 into main Jul 14, 2020
@josepot josepot deleted the propagate-updates branch July 14, 2020 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants