File tree 3 files changed +7
-9
lines changed
3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -594,7 +594,7 @@ describe('reactivity/computed', () => {
594
594
595
595
v . value += ' World'
596
596
await nextTick ( )
597
- expect ( serializeInner ( root ) ) . toBe ( 'Hello World World World' )
597
+ expect ( serializeInner ( root ) ) . toBe ( 'Hello World World World World ' )
598
598
// expect(COMPUTED_SIDE_EFFECT_WARN).toHaveBeenWarned()
599
599
} )
600
600
@@ -892,7 +892,7 @@ describe('reactivity/computed', () => {
892
892
v . value += ' World'
893
893
await nextTick ( )
894
894
expect ( serializeInner ( root ) ) . toBe (
895
- 'Hello World World World | Hello World World World' ,
895
+ 'Hello World World World World | Hello World World World World' ,
896
896
)
897
897
} )
898
898
@@ -962,6 +962,7 @@ describe('reactivity/computed', () => {
962
962
} )
963
963
} )
964
964
965
+ // #11797
965
966
test ( 'should prevent endless recursion in self-referencing computed getters' , async ( ) => {
966
967
const Comp = defineComponent ( {
967
968
data ( ) {
@@ -998,7 +999,7 @@ describe('reactivity/computed', () => {
998
999
} )
999
1000
const root = nodeOps . createElement ( 'div' )
1000
1001
render ( h ( Comp ) , root )
1001
- expect ( serializeInner ( root ) ) . toBe ( `<button>Step</button><p></p>` )
1002
+ expect ( serializeInner ( root ) ) . toBe ( `<button>Step</button><p>Step 1 </p>` )
1002
1003
triggerEvent ( root . children [ 1 ] as TestElement , 'click' )
1003
1004
await nextTick ( )
1004
1005
expect ( serializeInner ( root ) ) . toBe ( `<button>Step</button><p>Step 2</p>` )
Original file line number Diff line number Diff line change @@ -111,9 +111,9 @@ export class ComputedRefImpl<T = any> implements Subscriber {
111
111
* @internal
112
112
*/
113
113
notify ( ) : void {
114
+ this . flags |= EffectFlags . DIRTY
114
115
// avoid infinite self recursion
115
116
if ( activeSub !== this ) {
116
- this . flags |= EffectFlags . DIRTY
117
117
this . dep . notify ( )
118
118
} else if ( __DEV__ ) {
119
119
// TODO warn
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ function isDirty(sub: Subscriber): boolean {
326
326
for ( let link = sub . deps ; link ; link = link . nextDep ) {
327
327
if (
328
328
link . dep . version !== link . version ||
329
- ( link . dep . computed && refreshComputed ( link . dep . computed ) === false ) ||
329
+ ( link . dep . computed && refreshComputed ( link . dep . computed ) ) ||
Has conversations. Original line has conversations. 330
330
link . dep . version !== link . version
331
331
) {
332
332
return true
@@ -344,10 +344,7 @@ function isDirty(sub: Subscriber): boolean {
344
344
* Returning false indicates the refresh failed
345
345
* @internal
346
346
*/
347
- export function refreshComputed ( computed : ComputedRefImpl ) : false | undefined {
348
- if ( computed . flags & EffectFlags . RUNNING ) {
349
- return false
350
- }
347
+ export function refreshComputed ( computed : ComputedRefImpl ) : undefined {
351
348
if (
352
349
computed . flags & EffectFlags . TRACKING &&
353
350
! ( computed . flags & EffectFlags . DIRTY )
You can’t perform that action at this time.