Skip to content

Support React components wrapped by 'mobx-react'#21349

Open
asgerf wants to merge 3 commits intogithub:mainfrom
asgerf:mobx-wrapper
Open

Support React components wrapped by 'mobx-react'#21349
asgerf wants to merge 3 commits intogithub:mainfrom
asgerf:mobx-wrapper

Conversation

@asgerf
Copy link
Contributor

@asgerf asgerf commented Feb 19, 2026

Adds support for React components that are wrapped by observer from mobx-react or mobx-react-lite, e.g:

import { observer } from "mobx-react-lite";

const TodoView = observer(({ todo }) => <div>{todo.title}</div>)

@github-actions github-actions bot added the JS label Feb 19, 2026
@asgerf asgerf marked this pull request as ready for review February 20, 2026 12:58
@asgerf asgerf requested a review from a team as a code owner February 20, 2026 12:58
Copilot AI review requested due to automatic review settings February 20, 2026 12:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for React components wrapped by the observer higher-order component from the mobx-react and mobx-react-lite packages. MobX is a popular state management library for React, and the observer HOC is used to make React components reactive to MobX observables. By treating observer as a higher-order component, CodeQL can now properly track data flow through components wrapped with this function.

Changes:

  • Added observer from mobx-react and mobx-react-lite to the list of recognized higher-order component builders
  • Added test coverage for components wrapped with observer from both packages
  • Added a change note documenting this minor analysis improvement

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
javascript/ql/lib/semmle/javascript/frameworks/React.qll Adds observer from mobx-react and mobx-react-lite to the higherOrderComponentBuilder predicate, treating it as a HOC that wraps React components
javascript/ql/test/library-tests/frameworks/ReactJS/higherOrderComponent.jsx Adds test imports for observer from both packages and tests wrapping a component with both versions of observer
javascript/ql/lib/change-notes/2026-02-20-mobx-react-observer.md Documents this as a minor analysis improvement in the change notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments