Skip to content

FormState onChange() support #40

@nighca

Description

@nighca

A method like FieldState's onChange, which activates the state, while without debounce, may be needed for FormState( & ArrayFormState)

With form state's onChange, if we look forward, maybe we should consider remove $, which makes fields manipulation available for users.

For object form state, fields manipulation (remove / add / replace) should be considered unnecessary.

For array form state, we can achieve fields manipulation with value operation (onChange and maybe other related methods such as append, remove, ...):

state.onChange(v => [...v, 'foo'])
// or
state.append('foo')
// instead of 
state.$.push(createFieldState('foo'))

If we avoid manipulation through $, the manipulation of state will be much more limited. So there will be more space for us to add features and introduce optimizations. #18 will partly benefit from this: fields of array form state will always be correctly disposed as we manipulate them inside of formstate-x only.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions