cerebral-forms issues
See original GitHub issueForm factory has wrong documentation . hasValue
, isPristine
, isValid
, errorMessage
will be ignored and overwriten.
Anyway, form factory returns lot of useless fields to be stored in state even if user doesn’t needs it.
{
value: '', // must be always present, it's ok now
validationRules: null, // should be omitted if not passed to form factory
validationMessages: null, // should be omitted if not passed to form factory
isRequired: false, // should be omitted if not passed to form factory
requiredMessage: null, // should be omitted if not passed to form factory
isValueRules: ['isValue'], // should only present if isRequired passed to form factory
defaultValue: '', // seems ok, but I would rename it to initialValue and made it optional
hasValue: false, // should never be in state, it is computed
isPristine: true, //should be in state, and set to false by changeField
isValid: true, // should never be in state, it is computed
errorMessage: null, // should never be in state, it is computed
}
so when I call form({field: {value}})
I expect only minimal state in my state-tree:
{
value: '',
defaultValue: '',
isPristine: true
}
Few more notes:
- should have better example for isTouched, maybe even demo implementation
Set a default value for the whole form
contains a typo (newForm)Custom global props
should go beforeSet a default value for the whole form
where it used- to make
changeField
be more composable it should accept params:
changeField(input`field`, input`value`)
// or
changeField(state`path.to.field`, input`value`)
changeField
is different from set, because it operates withvalue
property and setsisDirty
- no need to run any validation on
changeField
since it can be computed validateField
ansvalidateForm
action factories is extraneous, see above 😃formToJSON
should have operator equivalent:
set(input`formValues`, form`pathToForm`)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:17 (17 by maintainers)
Top Results From Across the Web
Cerebral Atrophy | National Institute of Neurological Disorders ...
Symptoms of cerebral atrophy: Many diseases that cause cerebral atrophy are associated with dementia, seizures, and a group of language ...
Read more >Brain Disorders: Causes, Symptoms, and Diagnosis - Healthline
There are different brain disorders that can be caused by illness, genetics, or injury. Each comes with different risks, diagnoses, and treatment.
Read more >Brain Lesions: Causes, Symptoms, Treatments - WebMD
Brain lesions can be caused by injury, infection, exposure to certain chemicals, problems with the immune system, and more.
Read more >Cephalic Disorders | Johns Hopkins Medicine
Many children with microcephaly may have an intellectual disability, as well as cerebral palsy, sensory disorders including vision problems, poor motor skills, ...
Read more >Cerebral Atrophy Symptoms & Causes - Baptist Health
Brain disease in all forms affects as many as one in six Americans and cerebral atrophy ... If you or a loved one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
New forms specification:
That means we can drop a lot of factories cause there is no validation happening inside the state tree anymore.
@christianalfoni please post here revisited blueprint for new forms getting in mind latest API changes