Skip to content

javascript: a handler that reaches a component through React context or redux connect props has no use, and path calls the two independent #1751

Closed

Description

@swapnilpaliwal-sd

A function that reaches a component through React context or redux connect props has no use in the graph, so the component that hands it to a JSX attribute never shows up. Seen in a real redux app (5 this.props.onX handlers) and in a context-based auth app.

// Auth.jsx
const Ctx = createContext(null);
export function Provider({ children }) {
  const logout = () => 'out';
  return <Ctx.Provider value={{ logout }}>{children}</Ctx.Provider>;
}
export function LogoutButton() {
  const { logout } = useContext(Ctx);
  return <button onClick={logout}>out</button>;
}
// Settings.jsx
function Settings(props) { return <button onClick={props.onClickLogout}>out</button>; }
const mapDispatchToProps = (dispatch) => ({
  onClickLogout: () => dispatch({ type: 'LOGOUT' }),
});
export default connect(null, mapDispatchToProps)(Settings);
  • impact src/Auth.jsx:4 (logout): lists only Provider [hop 1], not LogoutButton.
  • path LogoutButton src/Auth.jsx:4: "the two are independent in this graph… no unresolved site would connect them".
  • impact src/Settings.jsx:4 (onClickLogout): lists only mapDispatchToProps [hop 1], not Settings.

Expected: LogoutButton and Settings list the handler as handed over (registered), the same way a directly imported onClick={logout} does. At the least, path should report the unresolved useContext destructure instead of saying the two are independent.

Activity

  1. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Consolidated into #1727, which tracks this issue together with related ones about JavaScript dispatch through computed tables, React context and connected props. The description and reproduction here still apply, and the fix for the group covers them.

  2. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Fixed by #1789 (merged into 0.1.9).

  3. added a commit that references this issue on Oct 11, 2026
    9bdddb8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingengineResolution / call-graph engine rulesjavascriptJavaScript

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions