Refactor ProfilerContext to use reducer instead of multi-state #16444
Open
Description
The ProfilerContext
is currently comprised of several pieces of related state, each managed with useState
. This necessitates awkward checks like this or even worse like this or this.
This context should be refactored to use a single reducer (useReducer
) like TreeContext
. This is a bit more involved at the moment because of suspense and the ProfilerContext
being higher level than the suspense cache. Although maybe we could work around this by using some sort of subscription?