From 21f7ba7b9d1bdd1b4fc4cd5105058394e781180d Mon Sep 17 00:00:00 2001 From: Philipp Schneider <47689073+philipp-tailor@users.noreply.github.com> Date: Thu, 27 Mar 2025 23:22:41 +0100 Subject: [PATCH] feat: change version view `modifiedOnly` default to `true` (#11794) Replaces a more elaborate approach from https://github.com/payloadcms/payload/pull/11520 with the simplest solution, just changing the default. --- packages/next/src/views/Version/Default/index.tsx | 6 +++--- packages/next/src/views/Version/index.tsx | 2 +- test/versions/e2e.spec.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/next/src/views/Version/Default/index.tsx b/packages/next/src/views/Version/Default/index.tsx index 034243c3d0..69f0d43f01 100644 --- a/packages/next/src/views/Version/Default/index.tsx +++ b/packages/next/src/views/Version/Default/index.tsx @@ -83,10 +83,10 @@ export const DefaultVersionView: React.FC = ({ current.set('localeCodes', JSON.stringify(selectedLocales.map((locale) => locale.value))) } - if (!modifiedOnly) { - current.delete('modifiedOnly') + if (modifiedOnly === false) { + current.set('modifiedOnly', 'false') } else { - current.set('modifiedOnly', 'true') + current.delete('modifiedOnly') } const search = current.toString() diff --git a/packages/next/src/views/Version/index.tsx b/packages/next/src/views/Version/index.tsx index 30a53a84d7..bd30670ca1 100644 --- a/packages/next/src/views/Version/index.tsx +++ b/packages/next/src/views/Version/index.tsx @@ -40,7 +40,7 @@ export async function VersionView(props: DocumentViewServerProps) { const comparisonVersionIDFromParams: string = searchParams.compareValue as string - const modifiedOnly: boolean = searchParams.modifiedOnly === 'true' + const modifiedOnly: boolean = searchParams.modifiedOnly === 'false' ? false : true const { localization } = config diff --git a/test/versions/e2e.spec.ts b/test/versions/e2e.spec.ts index 42b3ea139b..e02a633030 100644 --- a/test/versions/e2e.spec.ts +++ b/test/versions/e2e.spec.ts @@ -1197,11 +1197,11 @@ describe('Versions', () => { const textInArrayES = page.locator('[data-field-path="arrayLocalized"][data-locale="es"]') - await expect(textInArrayES).toContainText('No Array Localizeds found') + await expect(textInArrayES).toBeHidden() await page.locator('#modifiedOnly').click() - await expect(textInArrayES).toBeHidden() + await expect(textInArrayES).toContainText('No Array Localizeds found') }) test('correctly renders diff for block fields', async () => {