-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] Pending state is always user-blocking #17382
Conversation
Fixes a bug where `isPending` is only set to `true` if `startTransition` is called from inside an input event. That's usually the case, but not always. Now it works regardless of where you call it.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c292c83:
|
Btw we track this in #17272 |
}, | ||
[value, config], | ||
); | ||
return prevValue; | ||
} | ||
|
||
function startTransition(setPending, config, callback) { | ||
const priorityLevel = getCurrentPriorityLevel(); | ||
runWithPriority( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we do this in a couple of internal places which seems like a very heavy weight way to do this. Going through the scheduler to do this. This adds to my suspicion that reading priorities from scheduler is the wrong model. It's not that scheduler dictates the priorities but it sometimes can be used as a default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's on my list of things to consider during expiration times refactor. Didn't want to couple it to this bugfix.
}, | ||
); | ||
runWithPriority( | ||
priorityLevel > NormalPriority ? NormalPriority : priorityLevel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, it's not obvious to me that calling startTransition should change the running "current" queue of the scheduler. It should only change the priority inside React. They're not necessarily 1:1.
let useTransition; | ||
let act; | ||
|
||
describe('ReactHooksWithNoopRenderer', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste name
Details of bundled changes.Comparing: 8e74a31...c292c83 react-native-renderer
Size changes (stable) |
Details of bundled changes.Comparing: 8e74a31...c292c83 react-native-renderer
react-art
react-dom
ReactDOM: size: 0.0%, gzip: 0.0% Size changes (experimental) |
Fixes a bug where
isPending
is only set totrue
ifstartTransition
is called from inside an input event. That's usually the case, but not always.Now it works regardless of where you call it.
Fixes #17272