You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At any point you can get the collected statistics using `Onyx.getMetrics()`.
367
-
This will return an object containing `totalTime`, `averageTime` and `summaries`.
368
-
`summaries` is a collection of statistics for each method it contains data about:
369
-
- method name
370
-
- total, max, min, average times for this method calls
371
-
- calls - a list of individual calls with each having: start time; end time; call duration; call arguments
372
-
- start/end times are relative to application launch time - 0.00 being exactly at launch
373
-
374
-
If you wish to reset the metrics and start over use `Onyx.resetMetrics()`
375
-
376
-
Finally, there's a `Onyx.printMetrics()` method which prints human statistics information on the dev console. You can use this method during debugging. For example add an `Onyx.printMetrics()` line somewhere in code or call it through the dev console. It supports 3 popular formats *MD* - human friendly markdown, *CSV* and *JSON*. The default is MD if you want to print another format call `Onyx.printMetrics({ format: 'csv' })` or
377
-
`Onyx.printMetrics({ format: 'json' })`.
378
-
379
-
Sample output of `Onyx.printMetrics()`
380
-
381
-
```
382
-
### Onyx Benchmark
383
-
- Total: 1.5min
384
-
- Last call finished at: 12.55sec
385
-
386
-
| method | total time spent | max | min | avg | time last call completed | calls made |
It can be useful to log why Onyx is calling `setState()` on a particular React component so that we can understand which key changed, what changed about the value, and the connected component that ultimately rendered as a result. When used correctly this can help isolate problem areas and unnecessary renders in the code. To enable this feature, pass `debugSetState: true` to the config and grep JS console logs for `[Onyx-Debug]`.
0 commit comments