Update store packages to match dedicated repo (#427)

* chore: update store dependency

* fix: form meta should never be undefined now

* chore: fix tests that only break on fast computers

Guess I don't need to upgrade my computer anytime soon 😅😅
This commit is contained in:
Corbin Crutchley
2023-09-02 01:00:27 -07:00
committed by GitHub
parent 09edc1fc1a
commit 4cb122551b
9 changed files with 2056 additions and 371 deletions

View File

@@ -129,7 +129,7 @@ export class FieldApi<TData, TFormData> {
{
value: this.getValue(),
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
meta: this.getMeta() ?? {
meta: this._getMeta() ?? {
isValidating: false,
isTouched: false,
...opts.defaultMeta,
@@ -211,8 +211,7 @@ export class FieldApi<TData, TFormData> {
}
// Default Meta
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (this.getMeta() === undefined) {
if (this._getMeta() === undefined) {
this.setMeta(this.state.meta)
}
}
@@ -229,7 +228,14 @@ export class FieldApi<TData, TFormData> {
this.validate('change', this.state.value)
}
getMeta = (): FieldMeta => this.form.getFieldMeta(this.name)
_getMeta = () => this.form.getFieldMeta(this.name)
getMeta = () =>
this._getMeta() ??
({
isValidating: false,
isTouched: false,
...this.options.defaultMeta,
} as FieldMeta)
setMeta = (updater: Updater<FieldMeta>) =>
this.form.setFieldMeta(this.name, updater)