Refactor: Modernize budget viewer state with Signals#170
Open
The-Boyo wants to merge 1 commit intoitalanta:mainfrom
Open
Refactor: Modernize budget viewer state with Signals#170The-Boyo wants to merge 1 commit intoitalanta:mainfrom
The-Boyo wants to merge 1 commit intoitalanta:mainfrom
Conversation
…nd child component budget-table to use signals other that RxJs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I began by identifying all the places where the parent and child components relied on RxJS streams (combineLatest, subscriptions, tap, ngOnInit logic) for state.
Next, I replaced those observable streams with Angular signals, created computed() values to derive the combined budgets, and replaced side-effect subscriptions using effect().
Finally, I updated the child component to accept signal-based inputs and removed lifecycle subscriptions, cleaning up the data flow so the parent’s reactive state drives the table directly.
With signal, state becomes easier to maintain because it contains less boilerplate. Signals also provide for faster state updates because they hold real data unlike RxJs which uses streams.
Signals reduce complexity to a large extend because they are easier to maintain and update synchronously while observables on the other hand have a complex set up system that makes it hard to tell even where a change occurs.
Both state management systems can coexist because observables are push-based event streams while signals are pull-based state containers.
I have used redux and it easier for managing global and complex state and handles asynchronous data better than local state management systems such as signals but signals shine when state is simple and local. All these systems compliment each other.