Skip to content

Conversation

@miuirussia
Copy link
Member

@miuirussiamiuirussia 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

@miuirussiamiuirussia changed the title Propagate event to 'this'Propagate SyntheticEvent to 'this' in preventDefault and stopPropagation functionsJan 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

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

Release in v6.1.0. Thanks!

Sign up for freeto 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

@miuirussia@pete-murphy@mjrussell