G6 icon indicating copy to clipboard operation
G6 copied to clipboard

Graph is not rendered in cloned container

Open sklinov opened this issue 2 years ago • 3 comments

Describe the bug

When using G6 inside React component my project requires using wrapper components that can clone it's children elements. So if container for G6 graph is one of those cloned elements (or its child) graph drawing seems to be lost. Not sure if that's a G6 issue or some React stuff.

Your Example Website or App

https://codesandbox.io/s/g6-cloned-container-u20zmx

Steps to Reproduce the Bug or Issue

You can see that in the example provided there' no graph. If you comment out the <Wrapper>...</Wrapper> section to see that graph is now rendered (using another container)

Expected behavior

I'd expect graph to be rendered in the container provided

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 100

Additional context

No response

sklinov avatar May 03 '22 13:05 sklinov

I think it is because the duplicated DOM id since you assign same id="container" to both div in <GraphContainer />, which is not valid in HTML

Yanyan-Wang avatar May 05 '22 12:05 Yanyan-Wang

@Yanyan-Wang No, that's not an issue - we can comment out the second one (it's for demonstration purposes only) and in dev tools we can see that only one id=container is present image

sklinov avatar May 06 '22 08:05 sklinov

The GraphContainer in your demo is created multiple times, and the graph is amounted to the first one. Try to make the container unique and stable.

Yanyan-Wang avatar Jun 16 '22 10:06 Yanyan-Wang

Hi, dear user. Since there was no response for a long time, we cannot figure out the answer of the problem you described. If there is new progress, feel free to open a new issue.

Yanyan-Wang avatar Aug 19 '22 09:08 Yanyan-Wang