bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.87k stars 135 forks source link

Error: "Failed to execute 'getComputedStyle' on 'Window'" #300

Closed jonschlinkert closed 2 months ago

jonschlinkert commented 7 months ago

It seems like the error happens randomly, but I'm sure it's related to something I haven't been able to figure out yet.

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at createsStackingContext (findStackingContext.js:11:16)
    at findStackingContext (findStackingContext.js:33:8)
    at compare2 (index.js:25:6)
    at react-resizable-panels.browser.esm.js:423:7
    at Set.forEach (<anonymous>)
    at recalculateIntersectingHandles (react-resizable-panels.browser.esm.js:398:28)
    at HTMLBodyElement.handlePointerMove (react-resizable-panels.browser.esm.js:352:5)

I'm using React 18, and I'm also not rendering the component on the server.

bvaughn commented 7 months ago

Sorry to hear that you're seeing this. This isn't going to be enough to go on for me to help though. If you're able to narrow down a repro, let me know.

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

FWIW I think this generally indicates that you're passing undefined to getComputedStyle – which I think would mean that the register drag handle element is missing, but I'm not sure how that would be possible given the code.

jonschlinkert commented 7 months ago

FWIW I think this generally indicates that you're passing undefined to getComputedStyle – which I think would mean that the register drag handle element is missing, but I'm not sure how that would be possible given the code.

I'm not using getComputedStyle. I am using a hook though, to check if window exists to prevent SSR in an attempt to fix this issue. But that doesn't work. I'm open to suggestions.

bvaughn commented 7 months ago

Sorry. I didn't mean "you" literally. I just meant, generally speaking, that error suggests that a value of undefined is being passed to getComputedStyle– which this library uses. I don't know how that would be possible though, looking at the code. I'll need a repro.

bvaughn commented 2 months ago

Going to close this issue as stale because it's been open for a long time in a "needs information" state. If we get more info on how to repro it, we can revisit it.