-
Notifications
You must be signed in to change notification settings - Fork 93
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(computedFrom): add initialValue + throw Error in case of not sync emit #122
fix(computedFrom): add initialValue + throw Error in case of not sync emit #122
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit a2a8c37. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ⌛ The following target is in progress ✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
Hello @dmorosinotto Thanks for this!! |
Hi @eneajaho sorry to directly push my code into PR without previous discussion in the issue #37 But if you agree we can discuss/refine the idea about computedFrom here directly on the code side 😉 I added “many comments” to explain my ideas and motivation, obviusly we’ll remove them befote merge, but let’s start the discussion and give me any feedback about my changes, even what you think about the breaking behaviour of throwing error 👀 |
Hi @eneajaho , @nartc I know you are both very busy following all the latest Angular news & community, but is there a chance someone would take a look at this PR and gives me any feedback or maybe start a discussion on what you don't like, to make it progress and eventually the changes needed before merging it? Thanks in advance and sorry to bother you, I really just want to be collaborative... not criticism! |
e.message.includes('NG601') || | ||
e.code == 601 | ||
) | ||
console.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nartc What do you think about this one?
I think we will need sth like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eneajaho when you ask me to open a new issue to discuss try catch handle error are you referring to those commented lines where I suggest a way to handle the error due to requireSync
to customize the message for computedForm
?
It looks good to me. It doesn't look breaking to me. There are some comments I'd like you to review. And we need to discuss the error-handling part with @nartc . Thanks for your patience. |
Hi @eneajaho thanks for your feedback reviewing my code, today I'm quite busy at work, but I'll take all your suggestions to update my code this evening (after 21:00 CEST)
|
@eneajaho , @nartc I fixed the CI errors - if you want to review the code and give me some feedback about what you think of the current "throwing error" behavior? BTW: I had to do some "try&error" to make a commit passing CI, but running local test always pass even with previous failing CI commits, I suspect that the CI is using some stricter linting rules! Can we align those so anyone can verify all code & test works as expected from CI before commit? Thanks PS: hope to meet you IRL at NGPoland next week, to discuss this or other Angular stuff 😉 |
Hi @dmorosinotto Regarding try catch error handling, would you mind opening an issue, so we can tackle it later and get this PR merged? Also, please can you fix those other change requests? And after that it should be good to be merged. |
Hi @eneajaho I've added a commit to fix remaining typo in docs. And just for clarification about the issue that you want me to open - are you referring to commented lines in |
I hate you guys for having fun at ngpoland conf without me so I rage merged this PR |
Thanks @nartc for merging it 🙏 |
Oh, I'm so sorry for you @nartc 🫶 |
Hi @eneajaho I've finally find the time to make some changes to computedFrom as prompted in #37
null
or initial input in case where observable don't have a valid sync emitted value.You document those cases as
tricky part
in the docs, but I believe that we can handle it differently throwing an error as the "native" AngulartoSignal
do, so the developer knows where his code will generate the problem and decide how to fix it!I changed the
computedFrom
implementation and tests to handle theinitialValue: Output
passed in options object as last parameter (the options object can be used even to pass theinjector
as before) - I rewrote the test that use the new behavior.In the last commit I updated the
docs
to explain these new behaviors: initialValue + throwing Error.I hope you can review this PR and give me some feedback, because in the old Issue we didn't have the opportunity to discuss much about how to proceed, and so I decided to complete the code and tests to have a discussion base, and maybe fix or improve it even more to have a "better"
computedFrom
🤓