I have a custom widget that is wrapped in the react-redux "connect" HOC. Until recently it worked, but now fails with "Error: Unsupported widget definition: object". I have tried reverting to old versions of rjsf, but to no avail.
connect({})(CustomWidget) to observe the errorTried various versions:
"Until recently it worked" -- do you know what exactly caused this to no longer work? Could it have been a non-rjsf dependency change?
I am currently trying to track that down. Weirdly it seems like nothing in my package.json changed between these builds, so maybe it has to with the either the schema or the data being fed to the rjsf form.
I am just confused atm, but I will give an update here when I track it down.
I can resolve the issue by applying this fix: https://github.com/rjsf-team/react-jsonschema-form/issues/1309#issuecomment-519552592
Basically wrapping the Redux connected component in a plain component, so that the error goes away.
This was not needed before and it seems to occur with latest version of the core React lib. Should we merge this issue with the other one (although it seems to be more specific to React.Memo)
Perhaps a bit clearer:
```js
import React from 'react'
import { connect } from 'react-redux'
const CustomWidget = ({ value, onChange, reduxProp, disabled }) => (
// whatever
)
const mapStateToProps = (state, ownProps) => ({
// reduxProp: ...
})
const ConnectedWidget = connect(mapStateToProps)(CustomWidget)
// Needs a wrapper due to this issue
// https://github.com/rjsf-team/react-jsonschema-form/issues/1736
const WrappedConnectedWidget = props =>
export default WrappedConnectedWidget
The same thing happened to me. The recent change was that you upgraded your react-redux package and they are using new react features that rjsf does not support yet. My temporary hack to make it work without reverting back to a lower version of react-redux was to wrap the connect call.
So, I wrote this:
const safeWrap = (Comp) => (props) => <Comp {...props} />
Then you just do this:
const ConnectedWidget = safeWrap(connect(mapStateToProps)(CustomWidget))
That works as a temp fix.
Most helpful comment
The same thing happened to me. The recent change was that you upgraded your react-redux package and they are using new react features that rjsf does not support yet. My temporary hack to make it work without reverting back to a lower version of react-redux was to wrap the connect call.
So, I wrote this:
Then you just do this:
That works as a temp fix.