File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
tests/runtime-runes/samples/async-attribute Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -744,6 +744,10 @@ export function flushSync(fn) {
744744 * @returns {Promise<void> }
745745 */
746746export async function tick ( ) {
747+ if ( async_mode_flag ) {
748+ return new Promise ( ( f ) => requestAnimationFrame ( ( ) => f ( ) ) ) ;
749+ }
750+
747751 await Promise . resolve ( ) ;
748752 // By calling flushSync we guarantee that any pending state changes are applied after one tick.
749753 // TODO look into whether we can make flushing subsequent updates synchronously in the future.
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export function createSubscriber(start) {
6969 subscribers += 1 ;
7070
7171 return ( ) => {
72- tick ( ) . then ( ( ) => {
72+ queueMicrotask ( ( ) => {
7373 // Only count down after timeout, else we would reach 0 before our own render effect reruns,
7474 // but reach 1 again when the tick callback of the prior teardown runs. That would mean we
7575 // re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default test({
99 <p>pending</p>
1010 ` ,
1111
12- async test ( { assert, target, component } ) {
12+ async test ( { assert, target } ) {
1313 const [ cool , neat , reset ] = target . querySelectorAll ( 'button' ) ;
1414
1515 flushSync ( ( ) => cool . click ( ) ) ;
You can’t perform that action at this time.
0 commit comments