Есть ли способ запустить профилировщик и перезагрузить страницу с помощью инструментов разработчика React и профилировщика? Подобно тому, как в инструментах разработчика Chrome есть кнопка для запуска профилирования и перезагрузки страницы.
В настоящее время, если я запускаю профилировщик и обновляю страницу, он останавливает профилировщик.





Я не знаю, можете ли вы нажать на запись и перезагрузить страницу, но если вы хотите измерить загрузку страницы, я думаю, вы можете поместить профилировщик в свой код, а затем консоль записать результаты. Что-то вроде этого:
logProfile = (id, phase, actualTime, baseTime, startTime, commitTime, interactions) => {
console.info(`--------- ${id}'s ${phase.toUpperCase()} phase: ---------`);
console.info(`Time spent rendering ${actualTime} ms`); // Time spent rendering the Profiler and its descendants for the most recent "mount" or "update" render.
console.info(`Base time: ${baseTime} ms`); // Duration of the most recent render time for each individual component within the Profiler tree.
console.info(`React render start time (since component mounted): ${startTime} ms`); // When the Profiler began the recently committed render.
console.info(`React render commit time (since component mounted): ${commitTime} ms`); // The time at which the current commit took place.
console.info(interactions);
};
А затем в вашем рендере:
<Profiler id = "entities" onRender = {this.logProfile}><Page /></Profiler>
To profile the initial render, you can use the reload and start profiling button, which will reload the page and start profiling before the initial render. You can then continue or stop recording as you normally would.
С тех пор в React Dev Tools добавлена кнопка перезагрузки и начала профилирования.
Проблема заключается в том, что Firefox не поддерживает необходимые API-интерфейсы для добавления кнопки перезагрузки и запуска профилирования. github.com/facebook/react/issues/21384
У меня есть Firefox 89.0 (64-разрядная версия) и плагин инструментов React Developer версии 4.13.5, и у меня нет кнопки перезагрузки. Забрали?