Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TouchRipple] Allows call imperative methods without event #31955

Merged
merged 1 commit into from
May 18, 2022

Conversation

alexfauquette
Copy link
Member

According to the typescript interface of the TouchRipple the ref should allows to call start and stop without the event argument.

export interface TouchRippleActions {
  start: (
    event?: React.SyntheticEvent,
    options?: StartActionOptions,
    callback?: () => void,
  ) => void;
  pulsate: (event?: React.SyntheticEvent) => void;
  stop: (event?: React.SyntheticEvent, callback?: () => void) => void;
}

But events properties such as event.type are used in start and stop methods which makes them return an error. WHen calling rippleRef.current.stop()

@mui-bot
Copy link

mui-bot commented Mar 23, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 6318b5e

@danilo-leal danilo-leal added the component: ButtonBase The React component. label Mar 23, 2022
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

@alexfauquette can you maybe share a sandbox where this fails? As far as I can see in the method that is updated the event has a default value, which is an {}.

@alexfauquette
Copy link
Member Author

@mnajdova Effectively, my report is unclear

Here is a minimal reproduction. With rippleRef.current.stop({}) it works, but with rippleRef.current.stop() I receive an error

https://codesandbox.io/s/basicbuttons-material-demo-forked-l1rd3u?file=/demo.tsx

@mnajdova
Copy link
Member

Thanks for sharing the sandbox, it explains things :)

@alexfauquette alexfauquette changed the title [TouchRipple] allows call imperative methods without event [TouchRipple] Allows call imperative methods without event May 18, 2022
@alexfauquette alexfauquette merged commit ec3a839 into mui:master May 18, 2022
@alexfauquette alexfauquette deleted the allows-ripple-without-event branch May 18, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ButtonBase The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants