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.
This commit is contained in:
Philipp Schneider
2025-03-27 23:22:41 +01:00
committed by GitHub
parent b863fd0915
commit 21f7ba7b9d
3 changed files with 6 additions and 6 deletions

View File

@@ -83,10 +83,10 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
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()

View File

@@ -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

View File

@@ -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 () => {