Skip to content

react-portals-cache issue when using ref's #793

@ConnorTJolley

Description

@ConnorTJolley

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:

  • Register your components ensuring 1 is a functional component that uses a instantiates a ref backed class, i.e. BryntumGrid in our case
  • Ensure you have to layouts, both referencing the same panel
  • Load layout 1
  • Observe the panel is populated and working correctly
    image
  • Load layout 2
  • Observe the panel is now empty and the DOM shows an empty react-portals-cache element
    image
  • Close the panel
  • Re-add the panel
  • Observe the panel is now rendered correctly and working fine

This 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):

  • Browser: Chrome
  • Version: 131.0.6778.140

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions