Skip to content

React 19.2x introduced performance tracks cause observables to be accessed outside reaction #4607

@ahoisl

Description

@ahoisl

Intended outcome:

Use React 19.2.x with mobx in development mode and observableRequiresReaction=true without being spammed by following warnings:
[mobx] Observable 'someProp' being read outside a reactive context.

Actual outcome:

With React 19.2.0, new performance tracks were introduced that show changed props for components:
https://react.dev/reference/dev-tools/react-performance-tracks#changed-props

If observable objects are passed into components, these performance tracks cause warnings if the observableRequiresReaction is enabled:
[mobx] Observable 'someProp' being read outside a reactive context.

How to reproduce the issue:

See the following minimal reproduction sandbox:
https://codesandbox.io/p/sandbox/component-performace-tracks-mobx-warnings-c8wkwy

  1. open the sandbox
  2. open the dev tools console
  3. click the "Next item" button
    -> see warnings logged in the console

Does not happen with same sandbox when using React 19.1.4:
https://codesandbox.io/p/sandbox/component-performace-tracks-no-warnings-ttx7gt

Versions

react 19.2.0 and higher
mobx 6.15.0 (but most probably every version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions