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

♻️ pass the Observable instance to the onFirstSubscribe callback #2539

Merged
merged 2 commits into from Jan 4, 2024

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Dec 22, 2023

Motivation

This is a simple quality of life improvement, but also fixes a typing issue I stumbled upon where TS claimed that the "observable" variable was not well defined when it referred to the outer scope variable (see example)

Changes

This change mimics the TC39 observable proposal (and various implementations) by providing a way to notify directly as a onFirstSubscribe parameter.

Contrary to the TC39 proposal and other implementations, it simply provide the observable instance, instead of introducing a new "observer" concept (Observable and Observer concepts are "merged" in our implementation).

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

This change mimics the [TC39 observable proposal][1] (and various
implementations) by providing a way to notify directly as a
onFirstSubscribe parameter.

Contrary to the TC39 proposal and other implementations, it simply
provide the observable instance, instead of introducing a new "observer"
concept (Observable and Observer concepts are "merged" in our
implementation).

This is a simple quality of life improvement, but also fixes a typing
issue I stumbled upon where TS claimed that the "observable" variable
was not necessary defined when it referred to the outer scope variable.

[1]: https://github.com/tc39/proposal-observable
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner December 22, 2023 16:37
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8e1fce9) 92.87% compared to head (e5b05dd) 92.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2539      +/-   ##
==========================================
- Coverage   92.87%   92.82%   -0.06%     
==========================================
  Files         227      227              
  Lines        6726     6714      -12     
  Branches     1480     1480              
==========================================
- Hits         6247     6232      -15     
- Misses        479      482       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

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

Nice!

@BenoitZugmeyer BenoitZugmeyer merged commit beab1d3 into main Jan 4, 2024
17 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/observable-init-param branch January 4, 2024 14:17
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

3 participants