InputText with optional value

UI Components for React
Post Reply
miguelangelcg25
Posts: 3
Joined: 27 Oct 2022, 07:37

27 Oct 2022, 07:52

I'm trying to create an InputText whose value is an optional property of my patient object, but fails with this error "Uncaught TypeError: patient.address is undefined" when address is not present. Am I missing something here? This should not fail on an optional property, it should be skipped instead.

Code: Select all

<InputText id="address" value={patient.address.line1} onChange={e => onInputChange(e, 'address.line1')} />
Last edited by miguelangelcg25 on 27 Oct 2022, 23:26, edited 1 time in total.

habubey
Posts: 34
Joined: 24 Aug 2022, 13:17

27 Oct 2022, 10:16

Hey!,

Yes, it looks like it should be. We have never encountered such a problem. Is it possible to send us a reproducer (via codesandbox etc. ) so we can check what the problem is?

miguelangelcg25
Posts: 3
Joined: 27 Oct 2022, 07:37

27 Oct 2022, 23:28

Seems to happen with nested properties only.

https://codesandbox.io/s/goofy-nighting ... src/App.js

miguelangelcg25
Posts: 3
Joined: 27 Oct 2022, 07:37

28 Oct 2022, 18:56

Dropdown has the same issue. I think this might be a common issue to input components.

https://codesandbox.io/s/late-https-mge ... src/App.js

habubey
Posts: 34
Joined: 24 Aug 2022, 13:17

29 Oct 2022, 21:23

Hey again,

Thank you for the reproducers we will check ASAP and if there is a type: bug we will fix it and will let you know.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest