Inferno: Textarea defaultValue

Created on 19 Jan 2017  路  11Comments  路  Source: infernojs/inferno

Observed Behaviour

defaultValue in textarea doesn't work when defaultValue in a prop or a state

https://jsfiddle.net/ua8hqfjf/16/

textarea goes blank when component receives new props: same behaviour when changing other inputs

inferno 1.2.0
macOS / Windowx / Linux
Safari / Chrome / Firefox / ...

bug

All 11 comments

You need to set value? We should cross validate how React does it.

This is definitely a bug, if it renders value on mount with <textarea defaultValue={this.props.textarea} onInput={this.props.handleTextareaChange} /> it should do the same on rerender when you change state. textarea should behave same as input field.

The issue is to do with this: https://github.com/infernojs/inferno/blob/master/src/DOM/wrappers/TextareaWrapper.ts#L73

It should work like this:
https://github.com/infernojs/inferno/blob/master/src/DOM/wrappers/InputWrapper.ts#L139

If someone can make a PR for it, that would be awesome :)

Thanks for leaving this open for someone to help (and setting them up to succeed)! I've been watching the repo, eager to learn more, and contribute where I can. I'll create a PR for this.

@craigmichaelmartin that would be awesome, please also include tests to avoid regression on future :)

I started looking into this and its little different task for textarea compared to input as textarea dont support native defaultValue. so we need logic for this.

This will be fixed in next release. Closing.

Is there an ETA on that release?

This week hopefully. We need to solve some build related issues to be able to release.

Is there a way for me to try out the unreleased build?

You can at least do it manually by making npm run build and replacing dist files in your apps node_modules/inferno/dist We are moving to lerna I need to speak with @longlho how to make release candidate

Was this page helpful?
0 / 5 - 0 ratings