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.

TypeError: Cannot read property 'offsetWidth' of null

See original GitHub issue

I try to place the diagram in a router then switch between other routers. Then I got this boy:

Uncaught TypeError: Cannot read property 'offsetWidth' of null
    at LabelWidget.render (LabelWidget.tsx:92)
    at finishClassComponent (react-dom.development.js:17160)
    at updateClassComponent (react-dom.development.js:17110)
    at beginWork (react-dom.development.js:18620)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at beginWork$1 (react-dom.development.js:23203)
    at performUnitOfWork (react-dom.development.js:22154)
    at workLoopSync (react-dom.development.js:22130)
    at performSyncWorkOnRoot (react-dom.development.js:21756)
    at react-dom.development.js:11089
    at unstable_runWithPriority (scheduler.development.js:653)
    at runWithPriority$1 (react-dom.development.js:11039)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
    at flushSyncCallbackQueue (react-dom.development.js:11072)
    at scheduleUpdateOnFiber (react-dom.development.js:21199)
    at Object.enqueueSetState (react-dom.development.js:12639)
    at LocationProvider.push../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:471)
    at index.js:103

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:10

github_iconTop GitHub Comments

1reaction
johnsmithloncommented, Jun 8, 2020

I have a similar error when using the react-tabs component and switching back and forth to a tab containing react-diagrams:

Uncaught TypeError: Cannot read property ‘offsetWidth’ of null at LabelWidget.render (LabelWidget.tsx:92) at finishClassComponent (react-dom.development.js:17160) at updateClassComponent (react-dom.development.js:17110) at beginWork (react-dom.development.js:18620) at HTMLUnknownElement.callCallback (react-dom.development.js:188) at Object.invokeGuardedCallbackDev (react-dom.development.js:237) at invokeGuardedCallback (react-dom.development.js:292) at beginWork$1 (react-dom.development.js:23203) at performUnitOfWork (react-dom.development.js:22157) at workLoopSync (react-dom.development.js:22130) at performSyncWorkOnRoot (react-dom.development.js:21756) at react-dom.development.js:11089 at unstable_runWithPriority (scheduler.development.js:653) at runWithPriority$1 (react-dom.development.js:11039) at flushSyncCallbackQueueImpl (react-dom.development.js:11084) at flushSyncCallbackQueue (react-dom.development.js:11072) at discreteUpdates$1 (react-dom.development.js:21893) at discreteUpdates (react-dom.development.js:806) at dispatchDiscreteEvent (react-dom.development.js:4168)

I tried to put the useEffect hook above but I get an error:

TypeScript error in C:/React/my-app/src/App.tsx(18,21): Argument of type ‘null’ is not assignable to parameter of type ‘DiagramModel<DiagramModelGenerics>’. TS2345

16 | useEffect(() => {
17 |   return () => {

18 | engine.setModel(null) | ^ 19 | } 20 | }, []) 21 |

0reactions
aaron-michauxcommented, Oct 8, 2021

I get this error when calling curve.getSVGCurve(), where curve is a BezierCurve.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'offsetWidth' of null
But I am getting the error "Uncaught TypeError: Cannot read property 'offsetWidth' of null" and my map is not getting load . My...
Read more >
TypeError: Cannot read property 'offsetWidth' of null #2 - GitHub
In my case the error occurs because I add/remove the 'InfiniteLoading' component via {#if items.indexOf(item) == 0} only at the beginning of a ......
Read more >
Uncaught TypeError: Cannot read property 'offsetWidth' of null
With the Parent Theme the error doesn't appear. I got a solution. I just wanted to raise that themegrill need to take more...
Read more >
Cannot read property 'offsetWidth' of null at e.read (uikit.min.js ...
Uncaught TypeError: Cannot read property 'offsetWidth' of null at e.read (uikit.min.js?2.0.5:3). Hi guys,. i'm updating my site from YOO_Katana ...
Read more >
"Cannot read property 'offsetWidth' of null" Error - concrete5
I have found that the problem with offsetWidth of Null (or 'a is null') comes from not having a set width on the...
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