I have a React component using SidePanel from @carbon/ibm-products. When rendering, I get the following error:
TypeError: Cannot read properties of undefined (reading 'setExtraStackFrame')
at setCurrentlyValidatingElement ...
The error disappears if I remove the SidePanel component, but I need it. I’ve tried matching dependency versions, but the error persists.
Here’s a simplified version of my component:
import React from 'react'
import { SidePanel } from '@carbon/ibm-products'
import '@carbon/ibm-products/scss/index-without-carbon.scss'
class MyComponent extends React.Component {
constructor(props) {
super(props)
this.state = { error: {} }
}
componentDidMount() {
this.setState({ error: '' })
}
render() {
const { onSubmit, isOpen, onClose } = this.props
return (
<SidePanel
className='test'
onRequestClose={() => onClose()}
title='Title'
actions={[
{ label: 'ok', onClick: () => onSubmit(), kind: 'primary' },
{ label: 'cancel', onClick: () => onClose(), kind: 'secondary' }
]}
>
Hello INSIDE SIDE
</SidePanel>
)
}
}
MyComponent.displayName = 'MyComponent'
MyComponent.propTypes = {
isOpen: PropTypes.bool,
onClose: PropTypes.func,
onSubmit: PropTypes.func
}
export default MyComponent
Why is setExtraStackFrame undefined, and how can I fix this while keeping SidePanel in the component?