Merge pull request #1719 from payloadcms/feat/1695-nullable-localized-array-and-blocks

Feat: allow null for non-default locales on arrays and blocks
This commit is contained in:
Jarrod Flesch
2023-01-10 11:23:46 -05:00
committed by GitHub
44 changed files with 448 additions and 139 deletions

View File

@@ -61,6 +61,7 @@ export default buildConfig({
localization: {
defaultLocale: 'en',
locales: ['en', 'es'],
fallback: true,
},
onInit: async (payload) => {
await payload.create({

View File

@@ -274,13 +274,13 @@ describe('Fields', () => {
});
});
it('should return empty array for arrays when no data present', async () => {
it('should return undefined arrays when no data present', async () => {
const document = await payload.create<ArrayField>({
collection: arrayFieldsSlug,
data: arrayDoc,
});
expect(document.potentiallyEmptyArray).toEqual([]);
expect(document.potentiallyEmptyArray).toBeUndefined();
});
it('should create with ids and nested ids', async () => {