Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.

PSA: Don't use non-persistent key for DatGui component #68

Open
borg opened this issue Apr 22, 2021 · 0 comments
Open

PSA: Don't use non-persistent key for DatGui component #68

borg opened this issue Apr 22, 2021 · 0 comments

Comments

@borg
Copy link

borg commented Apr 22, 2021

Spent hours digging into issue with Slider not working properly and throwing the error

TypeError: Cannot read property 'getBoundingClientRect' of null

It would lose its sliderRef.current. In the end it turns out it was unrelated to the slider component, and instead related to me not assigning a persistent key value to the DatGui component itself. Out of habit I was using a counter to assign unique keys to components, and seemingly unless key is persistent between renders DatGui does not work as expected.

This is perhaps obvious, but it wasn't to me. If you run into this issue, here's saving you a few hours.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant