Closed OhKai closed 6 months ago
I also just noticed this error popping up occasionally, when you navigate between pages:
It probably has to do with the controlStore.registerControls()
call inside useRegisterControls()
being called outside a useEffect
because it can update state for components while they are being rendered. If this is done to guarantee that the control is set before the callbacks are added, we maybe should change the callbacks to be lazy so that you can add them even if the control is not set yet.
Fixed the error of 'Cannot update a component while rendering a different component' with your mentioned lazy loading.
As for #258: The reason being, that the modeller had no control-area added yet.
Both should be settled with #260
Describe the bug When trying to use 'controlenter' in the export modal on the process modeler page, it doesn't submit the form.
To Reproduce
Additional context I fixed the bug that happened before, where a reload of the modeler page would crash the site, because the export modal tried to use the 'process-list' control eventhough it wasn't registered. The
useAddControlCallback
hook now first checks if the control even exists.For components like these that are used in multiple pages, we need a more generic solution. I think either let the user provide multiple control ids or have a generic way of creating a new control area if one doesn't exist already.
Additionally, there is currently no way to unregister a control if the user navigates to a new page. The store will just grow over time.