Refactor: app config and header component signals #2427
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.
PR Checklist
TODO
Description
Following recent improvements to app config handling, update the main
app.component.ts
andapp.header.ts
to make use of signals, computes and effects. These should be generally more performant and simplify some of the more complex usage patterns (e.g. rxjs observable subscriptions)Review Notes
See demo below triggering skin change which should also trigger knock-ons to theme, header and footer config. These appeared to all be working as expected when testing locally, but would be good to verify
Screenity.video.-.Sep.18.2024.webm
Dev Notes
I've started just refactoring these components as they are the most visible in the app and so should have the most immediate benefit/impact. There's around 10-15 additional services which call the appConfigService and could potentially be refactored, although most of these are less related to UI (but would still likely benefit from more fine-grained update handling).
It's hard to measure the exact performance improvements, although see benchmarks from angular profiler below. These are skewed however as angular change detection runs more greedily in development mode than production anyways, but should still give some indication
Git Issues
Closes #
Screenshots/Videos
Before
Using angular devtools profiler, can see while switching skins a huge number of change detection cycles triggered
After
Minimal detection cycles triggered