Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Fix build on react@next
  • Loading branch information
MatanBobi committed Jul 4, 2020
commit f9557bf11b81e42aafe84566295e788d1d38b93c
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@reach/router": "^1.3.3",
"@testing-library/jest-dom": "^5.10.1",
"@types/react-dom": "^16.9.8",
"@types/scheduler": "^0.16.1",
"dotenv-cli": "^3.1.0",
"dtslint": "3.6.12",
"kcd-scripts": "^6.2.3",
Expand All @@ -61,7 +62,8 @@
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
"react-dom": "*",
"scheduler": "*"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
Expand Down
10 changes: 9 additions & 1 deletion src/flush-microtasks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
unstable_scheduleCallback as scheduleCallback,
unstable_NormalPriority as normalPriority,
} from 'scheduler'
/* istanbul ignore file */
// the part of this file that we need tested is definitely being run
// and the part that is not cannot easily have useful tests written
Expand Down Expand Up @@ -59,7 +63,11 @@ export default function flushMicroTasks() {
jest.advanceTimersByTime(0)
resolve()
} else {
enqueueTask(resolve)
scheduleCallback(normalPriority, () => {
enqueueTask(() => {
resolve()
})
})
}
},
}
Expand Down