Solutionunvalidated

Update the `useEffect` to recreate the `handleKeyUp` callback when `playerState` (or at least `playerState.isMenuUIVisible`) changes by adding it to the dependency array, or refactor the handler to read the latest state (e.g., via a ref) so it doesn’t rely on stale closure values.

45473e1b-037b-4d58-8b9d-3baed6ecf4a7

Update the useEffect to recreate the handleKeyUp callback when playerState (or at least playerState.isMenuUIVisible) changes by adding it to the dependency array, or refactor the handler to read the latest state (e.g., via a ref) so it doesn’t rely on stale closure values.