Skip to content

useCombobox appears to be incompatible with react compiler #1646

Closed

Description

@MattyBalaam

If I try and type in an input on combobox then the value does not update. If I add 'use no memo'; to the file to opt out then it works as expected.

I have created a minimal reproduction: https://stackblitz.com/edit/vitejs-vite-jzpospa2?file=src%2FApp.jsx

Activity

  1. MattyBalaam commented on May 8, 2025

    @MattyBalaam
    Author
    Screen.Recording.2025-05-08.at.08.52.55.mov
  2. silviuaavram commented on Jun 2, 2025

    @silviuaavram
    Collaborator

    Hey @MattyBalaam I'm not aware of the react compiler, can your provide more info and maybe suggest improvements? Thanks!

  3. MattyBalaam commented on Jun 2, 2025

    @MattyBalaam
    Author

    It is the “auto memo” feature React has been building for a few years and is now in RC: https://react.dev/blog/2025/04/21/react-compiler-rc

    You can see it in use on the linked minimal reproduction

  4. MattyBalaam commented on Jun 3, 2025

    @MattyBalaam
    Author

    I have tried to take a look with Downshift installed locally. Adding the new lint rule threw up some warnings:

    /Users/matthewbalaam/downshift/src/hooks/useCombobox/index.js
       96:5  warning  React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array                                                                                                                                                                                          react-hooks/exhaustive-deps
      117:4  warning  React Hook useMemo has unnecessary dependencies: 'inputRef.current', 'menuRef.current', and 'toggleButtonRef.current'. Either exclude them or remove the dependency array. Mutable values like 'menuRef.current' aren't valid dependencies because mutating them doesn't re-render the component  react-hooks/exhaustive-deps
    
    /Users/matthewbalaam/downshift/src/hooks/useSelect/index.js
      136:7  warning  React Hook useMemo has unnecessary dependencies: 'menuRef.current' and 'toggleButtonRef.current'. Either exclude them or remove the dependency array. Mutable values like 'menuRef.current' aren't valid dependencies because mutating them doesn't re-render the component  react-hooks/exhaustive-deps
    
    ✖ 3 problems (0 errors, 3 warnings)
    
  5. phryneas commented on Jun 3, 2026

    @phryneas
    Contributor

    Yeah, I just updated downshift a few majors, and it has actually gotten a lot worse :/

    The pattern of const latestState = latest.current.state to keep functions like getInputProps stable references means that the compiler will never re-execute getInputProps - because it assumes that it will be side-effect free.
    Right now, downshift is violating the rules of React left and right :/

    That means the component will never see any new state on re-execution.

    I would like to offer a PR to get this Compiler-compatible, but it would mean ripping quite a lot of stuff out. Would you be willing to accept such a PR?

  6. silviuaavram commented on Jun 30, 2026

    @silviuaavram
    Collaborator

    fixed by #1690

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions