statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.16k stars 1.25k forks source link

Bug: Temperature converter demo has an error in console #3098

Closed JackEdwardLyons closed 2 years ago

JackEdwardLyons commented 2 years ago

Description

When updating the inputs in the temperature converter demo, the following error occurs:

Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
    at input
    at label
    at section
    at TempConv (https://68083.csb.app/src/index.tsx:27:46)
    at App

Expected result

No error in the console.

Actual result

Error in the console:

Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
    at input
    at label
    at section
    at TempConv (https://68083.csb.app/src/index.tsx:27:46)
    at App

Reproduction

https://codesandbox.io/s/7guis-temperature-68083?from-embed

Additional context

Simpy update the inputs in the demo and check the console to see the error.

davidkpiano commented 2 years ago

This has now been fixed; not related to XState:

-value={C}
+value={C ?? '')

// etc.