Набор пустых взаимодействий и отсутствие реквизита / состояния в React Profiler - PullRequest
0 голосов
/ 11 ноября 2019

Я использую пакеты npm для React:

"react": "^16.8.4",
"react-dom": "^16.8.4"

и инструменты React Dev версии 4.2.0

Однако я хочу использовать профилировщик React для анализа производительности моего приложенияЯ не вижу фактического содержания реквизита или состояния между фазами фиксации:

enter image description here

В профилировщике отображается, какие реквизиты были изменены, но я действительно хочу видетькак выглядит реквизит, как показано здесь :

enter image description here

Кроме того, я завернул свой компонент с unstable_Profiler, чтобы войтивзаимодействия устанавливаются с помощью обратного вызова onRender следующим образом:

import React, { Component, Fragment, unstable_Profiler as Profiler } from 'react';

class MyApp extends Component {
  onRender = (
    id, // the "id" prop of the Profiler tree that has just committed
    phase, // either "mount" (if the tree just mounted) or "update" (if it re-rendered)
    actualDuration, // time spent rendering the committed update
    baseDuration, // estimated time to render the entire subtree without memoization
    startTime, // when React began rendering this update
    commitTime, // when React committed this update
    interactions // the Set of interactions belonging to this update
    ) => {
      console.log(`id=${id} phase=${phase} actualDuration=${actualDuration} baseDuration=${baseDuration}
      startTime=${startTime} commitTime=${commitTime}`)
      console.log('interactions', interactions)
  }

  render() {
    return (
      <Profiler id="123" onRender={this.onRender}>
        //MyApp component
      <Profiler>
  }
}

Хотя я вижу журналы для всех параметров onRender, журнал взаимодействия всегда отображает пустой набор (в то время какна самом деле это реквизит).

Кто-нибудь испытывал такие проблемы, как у меня? Я не мог найти подобные проблемы.

...