Hello,
I have a React component being rendered in the rowExpander using the createPortal from react-dom, similar to this:
rowExpanderFeature: {
renderer: async ({ record, region, expanderElement }) => {
expanderElement.innerHTML = ''
const key = `${record.id.toString()}__${region}`
const reactContainer = document.createElement('div')
reactContainer.style.width = '100%'
reactContainer.style.height = '320px'
expanderElement.append(reactContainer)
createPortal(<MyComponent/>, reactContainer, key)
return document.createElement('div')
}
},
},
and that works fine, additionally I'm using the rowCollapse event listener to remove the created element from the DOM when the row is collapsed.
The issue with this approach is that we have a functionally that triggers a full page reload. If that reload is triggered with the row still expanded, the element is never removed from the DOM causing my app to crash trying to render it (before the scheduler is even initialized).
Is that a workaround for this? Maybe a different way of displaying the react component without having to create new elements in the DOM?