File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/react-devtools-extensions/src Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,23 @@ const LOCAL_STORAGE_SUPPORTS_PROFILING_KEY =
3030const isChrome = getBrowserName ( ) === 'Chrome' ;
3131const isEdge = getBrowserName ( ) === 'Edge' ;
3232
33+ // since Chromium v102, requestAnimationFrame no longer fires in devtools_page (i.e. this file)
34+ // mock requestAnimationFrame with setTimeout as a temporary workaround
35+ // https://github.com/facebook/react/issues/24626
36+ // The polyfill is based on https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
37+ if ( isChrome || isEdge ) {
38+ const FRAME_TIME = 16 ;
39+ let lastTime = 0 ;
40+ window . requestAnimationFrame = function ( callback , element ) {
41+ const now = window . performance . now ( ) ;
42+ const nextTime = Math . max ( lastTime + FRAME_TIME , now ) ;
43+ return setTimeout ( function ( ) {
44+ callback ( ( lastTime = nextTime ) ) ;
45+ } , nextTime - now ) ;
46+ } ;
47+ window . cancelAnimationFrame = clearTimeout ;
48+ }
49+
3350let panelCreated = false ;
3451
3552// The renderer interface can't read saved component filters directly,
You can’t perform that action at this time.
0 commit comments