@@ -110,13 +110,11 @@ export class Derived<T, TChangeSummary = any> extends BaseObservable<T, void> im
110
110
return result ;
111
111
} else {
112
112
do {
113
+ // We might not get a notification for a dependency that changed while it is updating,
114
+ // thus we also have to ask all our depedencies if they changed in this case.
113
115
if ( this . state === DerivedState . dependenciesMightHaveChanged ) {
114
- // We might not get a notification for a dependency that changed while it is updating,
115
- // thus we also have to ask all our depedencies if they changed in this case.
116
- this . state = DerivedState . upToDate ;
117
-
118
116
for ( const d of this . dependencies ) {
119
- /** might call {@link handleChange} indirectly, which could invalidate us */
117
+ /** might call {@link handleChange} indirectly, which could make us stale */
120
118
d . reportChanges ( ) ;
121
119
122
120
if ( this . state as DerivedState === DerivedState . stale ) {
@@ -126,6 +124,12 @@ export class Derived<T, TChangeSummary = any> extends BaseObservable<T, void> im
126
124
}
127
125
}
128
126
127
+ // We called report changes of all dependencies.
128
+ // If we are still not stale, we can assume to be up to date again.
129
+ if ( this . state === DerivedState . dependenciesMightHaveChanged ) {
130
+ this . state = DerivedState . upToDate ;
131
+ }
132
+
129
133
this . _recomputeIfNeeded ( ) ;
130
134
// In case recomputation changed one of our dependencies, we need to recompute again.
131
135
} while ( this . state !== DerivedState . upToDate ) ;
0 commit comments