fix: object validation collapsed (#416)
This commit is contained in:
committed by
GitHub
parent
dad93b42fc
commit
d17378d557
@ -3,9 +3,13 @@ import { getDataPath } from '@staticcms/core/lib/i18n';
|
||||
import type { I18nSettings } from '@staticcms/core/interface';
|
||||
import type { RootState } from '@staticcms/core/store';
|
||||
|
||||
export const getEntryDataPath = (i18n: I18nSettings | undefined) => {
|
||||
return (i18n && getDataPath(i18n.currentLocale, i18n.defaultLocale)) || ['data'];
|
||||
};
|
||||
|
||||
export const selectFieldErrors =
|
||||
(path: string, i18n: I18nSettings | undefined) => (state: RootState) => {
|
||||
const dataPath = (i18n && getDataPath(i18n.currentLocale, i18n.defaultLocale)) || ['data'];
|
||||
const dataPath = getEntryDataPath(i18n);
|
||||
const fullPath = `${dataPath.join('.')}.${path}`;
|
||||
return state.entryDraft.fieldsErrors[fullPath] ?? [];
|
||||
};
|
||||
|
Reference in New Issue
Block a user