While playing around with using forwardRef in the over_react redux todo demo app, I discovered that if a JS component makes use of event.persist(), a runtime exception occurs if that JS component is wrapped with forwardRef as a result of the Dart event wrapper not having a method called persist.
This PR remedies that issue in a non-breaking way by adding a public - but very ominous field $$jsPersistDoNotSetThisOrYouWillBeFired - which gets set to a function by that analogous synthetic event factory in react_client.dart. This field will call the JS event.persist() function when called on the Dart side. The use of this field was necessary since the pre-existing pattern was to add have an argument in the constructor that would do the same _(e.g. SyntheticEvent._preventDefault gets set via the _preventDefault argument in the constructor)_. Following this pre-existing pattern would require us to make breaking changes to numerous public constructor signatures.
@aaronlademann-wf Do you have steps to reproduce this? I'm still having trouble seeing how a JS component could call a the Dart synthetic event's method; seems like some other issue may be at play here.
While playing around with using
forwardRef
in the over_react redux todo demo app, I discovered that if a JS component makes use ofevent.persist()
, a runtime exception occurs if that JS component is wrapped withforwardRef
as a result of the Dart event wrapper not having a method calledpersist
.This PR remedies that issue in a non-breaking way by adding a public - but very ominous field
$$jsPersistDoNotSetThisOrYouWillBeFired
- which gets set to a function by that analogous synthetic event factory inreact_client.dart
. This field will call the JSevent.persist()
function when called on the Dart side. The use of this field was necessary since the pre-existing pattern was to add have an argument in the constructor that would do the same _(e.g.SyntheticEvent._preventDefault
gets set via the_preventDefault
argument in the constructor)_. Following this pre-existing pattern would require us to make breaking changes to numerous public constructor signatures.FYA: @sydneyjodon-wk @joebingham-wk @greglittlefield-wf @kealjones-wk