fix(ui): clearing value from relationship filter leaves stale query (#11023)

When filtering the list view using conditions on a relationship field,
clearing the value from the field would leave it in the query despite
being removed from the component.
This commit is contained in:
Jacob Fletcher
2025-02-06 17:44:32 -05:00
committed by GitHub
parent ec593b453e
commit 7a73265bd6
3 changed files with 35 additions and 7 deletions

View File

@@ -44,6 +44,7 @@ import { reorderColumns } from '../../../helpers/e2e/reorderColumns.js'
import { reInitializeDB } from '../../../helpers/reInitializeDB.js'
import { POLL_TOPASS_TIMEOUT, TEST_TIMEOUT_LONG } from '../../../playwright.config.js'
import { addListFilter } from 'helpers/e2e/addListFilter.js'
const filename = fileURLToPath(import.meta.url)
const currentFolder = path.dirname(filename)
const dirname = path.resolve(currentFolder, '../../')
@@ -356,6 +357,24 @@ describe('List View', () => {
await expect(page.locator('.condition__value input')).toHaveValue('')
})
test('should remove condition from URL when value is cleared', async () => {
await page.goto(postsUrl.list)
await addListFilter({
page,
fieldLabel: 'Relationship',
operatorLabel: 'equals',
value: 'post1',
})
await page.waitForURL(/&where/)
const valueInput = page.locator('.condition__value')
const removeButton = valueInput.locator('.clear-indicator').click()
await page.waitForURL(/^(?!.*&where)/)
})
test('should accept where query from valid URL where parameter', async () => {
// delete all posts created by the seed
await deleteAllPosts()