question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'offsetWidth' of undefined

See original GitHub issue

Serialization doesn’t seem to work with Labels. Easiest repro is to call link1.addLabel('label') in demos/demo-serializing https://github.com/projectstorm/react-diagrams/blob/master/packages/diagrams-demo-gallery/demos/demo-serializing/index.tsx#L27-L28

I was able to track down the issue to https://github.com/projectstorm/react-diagrams/blob/master/packages/react-diagrams-core/src/entities/link/LinkWidget.tsx#L106-L114 where LabelWidget is rendered directly. Should it be using registered Label factory instead?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JRMaitrecommented, May 7, 2020

@gthx I was facing the same issue, and as a work around, I render the deserialized model after the engine has already been rendered once. It fixed the issue for me.

So in React I load the engine with an empty model and let React render it, then I added a useEffect to load the deserialized data on mount. Then the diagram renders as expected.

0reactions
oussamajabnounicommented, Jun 18, 2021

Same issue here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Cannot read property 'offsetWidth' of undefined with ...
I created a carousel with Bootstrap 3.3 and it works on my local machine, but when I upload the whole thing on server...
Read more >
TypeError: Cannot read property 'offsetWidth' of Null in JS
The "Cannot read property 'offsetWidth' of null" error occurs when trying to access the offsetWidth property on a null value. To solve the...
Read more >
Cannot read property 'offsetWidth' of undefined when updating ...
Uncaught TypeError : Cannot read property 'offsetWidth' of undefined. The issue is happening even on the demo component when editing a cell:
Read more >
Uncaught TypeError: Cannot read property 'offsetWidth' of null
I am using a child theme so I think this is the problem BUT – this isn't the first time a Spacious theme...
Read more >
Uncaught TypeError: Cannot read property 'offsetWidth' of ...
Hi everyone! When I tried to use the library, I got this error: Uncaught TypeError: Cannot read property 'offsetWidth' of undefined at new ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found