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

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

@borg

Description

@borg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions