Skip to content

[Select] Label is throwing as parent is 'undefined' when unmounting/hiding component #576

@amandac628

Description

@amandac628

Prerequisites

Describe the issue

When using React to do condition rendering, Select will throw the following error:

Image

How to replicate:

  1. Create a react application
  2. Create a state (e.g const [show, setShow] = useState<boolean>(false))
  3. With click of button or any trigger, toggle state value setShow((prev => !prev)
  4. In render: return show ? <SgdsSelect>...</SgdsSelect> : <></>

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

Describe your frontend stack. What version of React and @govtechsg/sgds-web-component are you using? CSR or SSR?

CSR, 3.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions