File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -683,7 +683,7 @@ export class FormStore {
683
683
}
684
684
685
685
// Avoid exponential loops when a large number of components are unloaded
686
- setTimeout ( ( ) => {
686
+ Promise . resolve ( ) . then ( ( ) => {
687
687
this . notifyWatch ( [ namePath ] ) ;
688
688
} )
689
689
} ;
Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ describe('useWatch', () => {
121
121
expect ( container . querySelector < HTMLDivElement > ( '.values' ) ?. textContent ) . toEqual ( 'bamboo' ) ;
122
122
123
123
rerender ( < Demo visible = { false } /> ) ;
124
+
125
+ await act ( async ( ) => {
126
+ await timeout ( ) ;
127
+ } ) ;
128
+
124
129
expect ( container . querySelector < HTMLDivElement > ( '.values' ) ?. textContent ) . toEqual ( '' ) ;
125
130
126
131
rerender ( < Demo visible /> ) ;
@@ -158,6 +163,11 @@ describe('useWatch', () => {
158
163
expect ( container . querySelector < HTMLDivElement > ( '.values' ) ?. textContent ) . toEqual ( 'bamboo' ) ;
159
164
160
165
rerender ( < Demo visible = { false } /> ) ;
166
+
167
+ await act ( async ( ) => {
168
+ await timeout ( ) ;
169
+ } ) ;
170
+
161
171
expect ( container . querySelector < HTMLDivElement > ( '.values' ) ?. textContent ) . toEqual ( '' ) ;
162
172
163
173
rerender ( < Demo visible /> ) ;
You can’t perform that action at this time.
0 commit comments