Bird
0
0

How can you optimize a computed signal that depends on multiple signals but only needs to update when one specific signal changes?

hard📝 Conceptual Q9 of 15
Angular - Signals
How can you optimize a computed signal that depends on multiple signals but only needs to update when one specific signal changes?
AUse a conditional inside computed to check the specific signal before recalculating
BComputed signals always update on any dependency change; optimization is not possible
CCreate separate computed signals for each dependency and combine them
DUse a signal instead of computed to manually control updates
Step-by-Step Solution
Solution:
  1. Step 1: Understand computed signals update on all dependencies

    Computed signals recalculate when any signal they call changes.
  2. Step 2: Use separate computed signals to isolate dependencies

    By splitting dependencies into separate computed signals, you can control which parts update when specific signals change.
  3. Final Answer:

    Create separate computed signals for each dependency and combine them -> Option C
  4. Quick Check:

    Split computed signals to optimize updates [OK]
Quick Trick: Split computed signals to isolate dependency updates [OK]
Common Mistakes:
  • Trying to conditionally skip recalculation inside computed
  • Using signals instead of computed for derived values
  • Assuming computed signals can selectively ignore dependencies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes