-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-portals-cache issue when using ref's #793
Comments
Happy to investigate but might need a little more info. When you say a component that "uses a ref for it's renderering" I'm not entirely sure what you mean by this in the context of React? Could you provide a small snippet of code to clarify please. |
Sorry, yeah, so for example: https://bryntum.com/products/grid/examples/frameworks/react-vite/basic/dist/ we are using this grid component from Bryntum, we have a component which interacts with our context and uses the BryntumGrid to present the data, so we would have something like:
Panel component declaration as:
With the |
Also may be worth noting, I am using Each
So each nested dockview instance is sharing components that are all defined in the root dockview, the issue of the panel content being empty in my instance would be that I also tried programmatically closing and re-opening the panel, to no success, it's still empty until you manually remove and re-add it |
How are you going about using the const MyGridComponent = (props: IDockviewPanelProps) => {
return <div>{/** render something */}</div>;
};
const components = {
myGridComponent: MyGridComponent,
};
const Test = () => {
const onReady = (event: DockviewReadyEvent) => {
//
};
return <DockviewReact onReady={onReady} components={components} />;
}; |
I've made a codesandbox to emulate how we've set it all up and I have commented out code that would just fail without the package: https://codesandbox.io/p/sandbox/zealous-hopper-l6n2k8 hopefully that helps With switching from |
Out of curiousity do you still experience the same issue if you set |
From what I can remember, yeah, tried individually specifying the component to have always as the renderer and on the DockviewReact itself. I have also tried unloading all panels in Which, as another note which makes it even more confusing, we also have another panel that is using the Which is also another reason why I was confused and was thinking it was either that the Dockview was doing something when trying to render the component and not passing through the ref properly or whether the library / component itself is doing something odd |
I logged on this morning and verified that it does not change the outcome, I have also recorded the following video to demonstrate exactly what I mean, the main panels are the:
2024-12-23.09-32-27.1.mp4As you can see, switching between the nested dock views loads it's own layout of panels, both sharing the same components, the |
Describe the bug
It seems that if you have a registered component which uses a ref for it's rendering, when switching to a layout that also shares the same panel component, the rendering of that panel seems to completely break, seemingly the react-portals-cache is also empty for this element.
To Reproduce
Steps to reproduce the behavior:
I tried to replicate the behaviour without using the same package that I'm experiencing it with (Bryntum Grid due to licensing and account being required to download the package, but:
react-portals-cache
elementThis issue, I'm unsure whether it's based on the Bryntum library I'm using or whether it's something with how the dockview handles loading components that were loaded in previous layouts and any updating of refs that may be required when rendering in a new DOM location or whether it's just based on my implementation that is causing it, any insight would be greatly appreciated
As when you close and re-add the panel, it works perfectly fine again afterwards
Expected behavior
I'd expect that components shared across different layouts (Nested dock view, etc) would continue to render fine without having to close & re-add the panel
Screenshots
SC's attached as part of steps to reproduce
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: