NG.II · Angular 22 practice question
A developer is using `linkedSignal` to derive a derived state from a source signal containing complex objects. They configure a custom equality check to only compare the `userId` property. What is the primary effect of providing this custom equality function?
const source = signal({ userId: 42, data: [1, 2] });
const derived = linkedSignal(() => source(), { equal: (a, b) => a.userId === b.userId });
Check answer and explanation
Correct answer: The derived signal will only trigger updates downstream if the comparison function determines the new value is not equivalent to the previous one based on the custom logic.
Explanation
The derived signal will only trigger updates downstream if the comparison function determines the new value is not equivalent to the previous one based on the custom logic.
Common trap
The statement that 'the derived signal will only update if the entire object structure changes, even if the `userId` remains constant' describes the default behavior of signals without custom equality, while the assertion that 'the custom equality function overrides the signal's internal change detection mechanism completely, making it immune to Angular's standard change detection cycle' is incorrect.
Source: Angular docs: Dependent state with `linkedSignal` — Custom equality comparison
Checked against the cited text on 2026-11-25.