Skip to content

Commit

Permalink
[react-dom] Add flushSync (#4566)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwiencek committed Feb 4, 2024
1 parent 208a92c commit 388e9ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -127,6 +127,8 @@ declare module 'react-dom' {

declare function unmountComponentAtNode(container: any): boolean;

declare function flushSync(callback: () => mixed): void;

declare function unstable_batchedUpdates<A, B, C, D, E>(
callback: (a: A, b: B, c: C, d: D, e: E) => mixed,
a: A,
Expand Down
Expand Up @@ -151,6 +151,10 @@ ReactDOM.render(<Example2 />, test$querySelector('#site'), '');
// $FlowExpectedError[incompatible-call]
ReactDOM.render(<Example2 />, test$querySelector('#site'), null);

(ReactDOM.flushSync(() => ''): void);
// $FlowExpectedError[incompatible-call]
ReactDOM.flushSync();

describe('react-dom/client', () => {
describe('createRoot', () => {
it('works', () => {
Expand Down

0 comments on commit 388e9ed

Please sign in to comment.