Skip to content

Commit dfa66bb

Browse files
committed
Use runWithPriority() for first iteration
1 parent 4a684dc commit dfa66bb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/use-transition-effect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { useCallback, useEffect, useRef, useState } from 'react';
1+
import { useCallback, useEffect, useRef, useState } from "react";
22
import {
33
unstable_cancelCallback as cancelCallback,
44
unstable_scheduleCallback as scheduleCallback,
55
unstable_shouldYield as shouldYield,
66
unstable_runWithPriority as runWithPriority,
77
unstable_ImmediatePriority as ImmediatePriority,
88
unstable_IdlePriority as IdlePriority,
9-
CallbackNode
10-
} from 'scheduler';
9+
CallbackNode,
10+
} from "scheduler";
1111

1212
/**
1313
* Cleanup function (like in the useEffect hook)
@@ -116,7 +116,7 @@ export function useTransitionEffect(): [
116116
}
117117
};
118118
// start synchronously
119-
const nextCallback = iterate();
119+
const nextCallback = runWithPriority(priorityLevel, () => iterate());
120120

121121
// we have next callback - schedule it
122122
if (nextCallback) {

0 commit comments

Comments
 (0)