Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.
This repository was archived by the owner on Dec 16, 2021. It is now read-only.

should not change input value when changing "defaultValue" attr. #445

Open

Description

@jo32

Activity

  1. gavar commented on Sep 20, 2018

    @gavar

    I can confirm the issue exists on version 3.18.4

    Lines of code affecting it:
    https://github.com/developit/preact-compat/blob/3.18.4/src/index.js#L96-L101

    You could temporary solve this problem by inverting logic after rendering, by calling this function on the react element:

    function fixDefaultValueBug(element, props) {
      const {value, defaultValue} = props;
      if (defaultValue) {
        if (!value && value !== 0) {
          delete element.props.value;
          element.props.defaultValue = defaultValue;
        }
      }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions