Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: facebook/react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ed966dac4a025fd37580e8197e5b271044ffbd9f
Choose a base ref
...
head repository: facebook/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d5bba18b5d81f234657586865248c5b6849599cd
Choose a head ref
  • 7 commits
  • 22 files changed
  • 1 contributor

Commits on Oct 9, 2024

  1. Configuration menu
    Copy the full SHA
    bf0c054 View commit details
    Browse the repository at this point in the history
  2. fix[react-devtools]: update profiling status before receiving respons…

    …e from backend (#31117)
    
    We can't wait for a response from Backend, because it might take some
    time to actually finish profiling.
    
    We should keep a flag on the frontend side, so user can quickly see the
    feedback in the UI.
    hoxyq authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    dbf80c8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    389a2de View commit details
    Browse the repository at this point in the history
  4. fix[react-devtools]: removed redundant startProfiling call (#31131)

    Stacked on #31118. See last
    commit.
    
    We don't need to call `startProfiling()` here, because we delegate this
    to the Renderer itself:
    
    https://github.com/facebook/react/blob/830e823cd2c6ee675636d31320b10350e8ade9ae/packages/react-devtools-shared/src/backend/fiber/renderer.js#L5227-L5232
    
    Since this is de-facto the constructor of Renderer, this will be called
    earlier.
    
    Validated via testing the reload-to-profile for Chrome browser
    extension.
    hoxyq authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    4a86ec5 View commit details
    Browse the repository at this point in the history
  5. fix[react-devtools]: remove all listeners when Agent is shutdown (#31151

    )
    
    Based on #31049, credits to
    @EdmondChuiHW.
    
    What is happening here:
    1. Once Agent is destroyed, unsubscribe own listeners and bridge
    listeners.
    2. [Browser extension only] Once Agent is destroyed, unsubscribe
    listeners from BackendManager.
    3. [Browser extension only] I've discovered that `backendManager.js`
    content script can get injected multiple times by the browser. When
    Frontend is initializing, it will create Store first, and then execute a
    content script for bootstraping backend manager. If Frontend was
    destroyed somewhere between these 2 steps, Backend won't be notified,
    because it is not initialized yet, so it will not unsubscribe listeners
    correctly. We might end up duplicating listeners, and the next time
    Frontend is launched, it will report an issues "Cannot add / remove node
    ...", because same operations are emitted twice.
    
    To reproduce 3 you can do the following:
    1. Click reload-to-profile
    2. Right after when both app and Chrome DevTools panel are reloaded,
    close Chrome DevTools.
    3. Open Chrome DevTools again, open Profiler panel and observe "Cannot
    add / remove node ..." error in the UI.
    hoxyq authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    1d8d120 View commit details
    Browse the repository at this point in the history
  6. refactor[react-devtools]: flatten reload and profile config (#31132)

    Stacked on #31131. See last
    commit.
    
    This is a clean-up and a pre-requisite for next changes:
    1. `ReloadAndProfileConfig` is now split into boolean value and settings
    object. This is mainly because I will add one more setting soon, and
    also because settings might be persisted for a longer time than the flag
    which signals if the Backend was reloaded for profiling. Ideally, this
    settings should probably be moved to the global Hook object, same as we
    did for console patching.
    2. Host is now responsible for reseting the cached values, Backend will
    execute provided `onReloadAndProfileFlagsReset` callback.
    hoxyq authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    bfe91fb View commit details
    Browse the repository at this point in the history
  7. fix[react-devtools]: record timeline data only when supported (#31154)

    Stacked on #31132. See last
    commit.
    
    There are 2 issues:
    1. We've been recording timeline events, even if Timeline Profiler was
    not supported by the Host. We've been doing this for React Native, for
    example, which would significantly regress perf of recording a profiling
    session, but we were not even using this data.
    2. Currently, we are generating component stack for every state update
    event. This is extremely expensive, and we should not be doing this.
    
    We can't currently fix the second one, because we would still need to
    generate all these stacks, and this would still take quite a lot of
    time. As of right now, we can't generate a component stack lazily
    without relying on the fact that reference to the Fiber is not stale.
    With `enableOwnerStacks` we could populate component stacks in some
    collection, which would be cached at the Backend, and then returned only
    once Frontend asks for it. This approach also eliminates the need for
    keeping a reference to a Fiber.
    hoxyq authored Oct 9, 2024
    Configuration menu
    Copy the full SHA
    d5bba18 View commit details
    Browse the repository at this point in the history
Loading