Skip to content
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

Performance optimisation for Links #19

Open
ddelpiano opened this issue Jul 28, 2022 · 0 comments
Open

Performance optimisation for Links #19

ddelpiano opened this issue Jul 28, 2022 · 0 comments
Labels
bug Something isn't working optimisation

Comments

@ddelpiano
Copy link
Member

Right now we get in console some warning about the key of the react object being already present in the DOM, this is due to the factory that re-create these components all the time.

This happens even without using the DefaultLinkWidget.generateLink, and also if I don't extend anymore the class DefaultLinkWidget.

My guess is that the cloneElement in the DefaultLinkSegmentWidget that creates top and bottom is not receiving the ref of the previous instance and then it's recreating all the time a brand new component.

Looking at the code it's not trivial where to fit this and it will possibly require a fork of react-diagram where we can do the fix since this should happen within their codebase in order to consume the ref correctly when the segment is cloned.

Warning: Encountered two children with the same key, `link-factory-link2`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
    at g
    at DefaultLinkSegmentWidget (http://localhost:3000/static/js/bundle.js:44192:1)
    at g
    at DefaultLinkWidget (http://localhost:3000/static/js/bundle.js:44251:5)
    at g
    at PeformanceWidget (http://localhost:3000/static/js/bundle.js:41450:1)
    at LinkWidget (http://localhost:3000/static/js/bundle.js:42427:5)
    at LinkLayerWidget (http://localhost:3000/static/js/bundle.js:42064:1)
    at SmartLayerWidget (http://localhost:3000/static/js/bundle.js:40703:1)
    at svg
    at http://localhost:3000/static/js/bundle.js:4394:66
    at TransformLayerWidget (http://localhost:3000/static/js/bundle.js:40765:5)
    at div
    at http://localhost:3000/static/js/bundle.js:4394:66
    at CanvasWidget (http://localhost:3000/static/js/bundle.js:40473:5)
    at div
    at MetaDiagram (http://localhost:3000/static/js/bundle.js:96502:5)
    at div
    at Main (http://localhost:3000/static/js/bundle.js:578:5)
    at WithStyles (http://localhost:3000/static/js/bundle.js:30846:23)
    at div
    at http://localhost:3000/static/js/bundle.js:4394:66
    at Box (http://localhost:3000/static/js/bundle.js:31764:72)
    at Layout (http://localhost:3000/static/js/bundle.js:1108:5)
    at InnerThemeProvider (http://localhost:3000/static/js/bundle.js:30976:70)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:29593:5)
    at ThemeProvider (http://localhost:3000/static/js/bundle.js:30996:5)
    at App
@ddelpiano ddelpiano added bug Something isn't working optimisation labels Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working optimisation
Projects
None yet
Development

No branches or pull requests

1 participant