react-turbo icon indicating copy to clipboard operation
react-turbo copied to clipboard

BUG: Can't support props destructure

Open HoikanChan opened this issue 2 years ago • 0 comments

props destructure will cause an error: Error: combine expects a store in a field updates

My code:

function A(props: { a?: string, b?: string, c?: string }) {
  const { a, b, c} = props;
  return <div>{a}</div>
}

The compiled code:

var A = react_turbo__WEBPACK_IMPORTED_MODULE_0__["reactify"](function A___(_ref) {
  var props = _ref.proxy;
  var _ds_tr_ctr = props;
 
 // I think here use combine with a proxy instead of the effector store cause the error 
  var c = react_turbo__WEBPACK_IMPORTED_MODULE_0__["combine"](_ds_tr_ctr, function (_ds_tr_ctr) { 
    return _ds_tr_ctr["c"];
  });
  var b = react_turbo__WEBPACK_IMPORTED_MODULE_0__["combine"](_ds_tr_ctr, function (_ds_tr_ctr) {
    return _ds_tr_ctr["b"];
  });
  var a = react_turbo__WEBPACK_IMPORTED_MODULE_0__["combine"](_ds_tr_ctr, function (_ds_tr_ctr) {
    return _ds_tr_ctr["a"];
  });

HoikanChan avatar Aug 09 '22 03:08 HoikanChan