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

Propagate SyntheticEvent to 'this' in preventDefault and stopPropagation functions #48

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

miuirussia
Copy link
Member

@miuirussia miuirussia commented Jan 10, 2023

Since purescript has ability to compile with different backends (as https://github.com/aristanetworks/purescript-backend-optimizer), functions can be compiled as arrow functions, which results error in react. So we must explicitly specify, that the preventDefault and stopPropagation functions require a SyntheticEvent in 'this'.

See: https://github.com/facebook/react/blob/afe6521e134178920f0523ede4c715942d8f0564/packages/react-dom-bindings/src/events/SyntheticEvent.js#L89

@miuirussia miuirussia changed the title Propagate event to 'this' Propagate SyntheticEvent to 'this' in preventDefault and stopPropagation functions Jan 10, 2023
@pete-murphy
Copy link
Member

Was able to reproduce the issue here https://github.com/ptrfrncsmrph/purescript-react-events-bug and confirmed the fix locally

@mjrussell
Copy link
Member

Thanks for this @miuirussia and @ptrfrncsmrph for additional testing. Just approved to run it through ci and should be able to get this in shortly

@mjrussell mjrussell merged commit 363b852 into purescript-react:main Jan 11, 2023
@mjrussell
Copy link
Member

Release in v6.1.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants