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

refactor(react-signals): simplify the implementation #2657

Merged
merged 27 commits into from
Aug 19, 2024

Conversation

Lodin
Copy link
Contributor

@Lodin Lodin commented Aug 15, 2024

No description provided.

@Lodin Lodin added the hilla Issues related to Hilla label Aug 15, 2024
@Lodin Lodin requested review from Legioth and taefi August 15, 2024 10:26
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.16%. Comparing base (c111161) to head (fb5add7).
Report is 1 commits behind head on main.

Files Patch % Lines
...ts/generator-plugin-signals/src/SignalProcessor.ts 97.05% 1 Missing ⚠️
packages/ts/react-signals/src/FullStackSignal.ts 97.05% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2657      +/-   ##
==========================================
- Coverage   92.17%   92.16%   -0.02%     
==========================================
  Files          78       76       -2     
  Lines        2454     2449       -5     
  Branches      634      636       +2     
==========================================
- Hits         2262     2257       -5     
+ Misses        145      144       -1     
- Partials       47       48       +1     
Flag Coverage Δ
unittests 92.16% <97.05%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@taefi taefi left a comment

Choose a reason for hiding this comment

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

Apart from some points I didn't fully understand (mentioned down there), In general, I like the way things got simpler. However, there are things I don't like:
In the currently existing implementation (main branch), the signal was isolated, while now it know about an external thing called channel and how it connects to the server and etc. SignalChannel also knows about the signal (ValueSignal), so now they are very coupled together.

packages/ts/react-signals/src/SignalChannel.ts Outdated Show resolved Hide resolved
@Lodin Lodin requested a review from taefi August 15, 2024 14:28
Copy link
Contributor

@taefi taefi left a comment

Choose a reason for hiding this comment

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

The followings seems to be missing:

  • Tests for SubscriptionManager's cancel and subscription public methods.
  • Tests for FullStackSignal's pending, error, updating public methods.

And, a misbehaviour is now happening at runtime, that is an update is sent to the server before even any call for subscription is made to the server. It is trying to set a null value on server-side instance, but since no subscription exists yet for the targeted signal instance, it simply fails with IllegalStateException causing unnecessary buzz in the console (both on client and on server).

Other details are commented on the code:

packages/ts/react-signals/src/FullStackSignal.ts Outdated Show resolved Hide resolved
packages/ts/react-signals/src/FullStackSignal.ts Outdated Show resolved Hide resolved
packages/ts/react-signals/src/FullStackSignal.ts Outdated Show resolved Hide resolved
packages/ts/react-signals/src/FullStackSignal.ts Outdated Show resolved Hide resolved
@Lodin Lodin requested a review from taefi August 19, 2024 08:49
Copy link

sonarcloud bot commented Aug 19, 2024

@Lodin Lodin merged commit cec4ccd into main Aug 19, 2024
14 of 15 checks passed
@Lodin Lodin deleted the feat/signals/value-signal branch August 19, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hilla Issues related to Hilla
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants