fix: added not found as errors when filter is active (#43497)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

fix: small issue when a filter was active and does not found error
popped up, we didn't allow users to reset the value. This handles the
edge cases where a filter is applied and the column is deleted
This commit is contained in:
Ali Waseem authored and GitHub committed 2026-03-08 13:43:28 -04:00
1 parent 14b2af415f
commit 819a9c0fc8
3 files changed
+65 -2

No files matched your search

@@ -15,7 +15,6 @@ describe('isFilterRelatedError', () => {
test('returns false for unrelated error messages', () => {
expect(isFilterRelatedError('connection refused')).toBe(false)
expect(isFilterRelatedError('permission denied for table users')).toBe(false)
expect(isFilterRelatedError('relation "users" does not exist')).toBe(false)
expect(isFilterRelatedError('Query cost exceeds threshold')).toBe(false)
})
@@ -84,4 +83,15 @@ describe('isFilterRelatedError', () => {
)
).toBe(true)
})
test('detects column does not exist errors from stale filters', () => {
expect(
isFilterRelatedError(
'Failed to run sql query: ERROR: 42703: column "first_name" does not exist'
)
).toBe(true)
expect(
isFilterRelatedError('Failed to run sql query: ERROR: 42P01: relation "users" does not exist')
).toBe(true)
})
})
@@ -6,6 +6,7 @@ const FILTER_ERROR_PATTERNS = [
'malformed array literal',
'invalid byte sequence',
'syntax error',
'does not exist',
]
export function isFilterRelatedError(errorMessage: string | undefined | null): boolean {
+53 -1
View File
@@ -14,7 +14,7 @@ import {
} from '../utils/filter-bar-helpers.js'
import { test } from '../utils/test.js'
import { toUrl } from '../utils/to-url.js'
import { createApiResponseWaiter } from '../utils/wait-for-response.js'
import { createApiResponseWaiter, waitForTableToLoad } from '../utils/wait-for-response.js'
const tableNamePrefix = 'pw_filter_bar'
@@ -1066,4 +1066,56 @@ test.describe('Filter Bar', () => {
}
})
})
test.describe('Stale Filter Cleanup', () => {
test('stale filter on dropped column shows filter error with remove button', async ({
page,
ref,
}) => {
const tableName = `${tableNamePrefix}_stale_drop`
await query(
`CREATE TABLE IF NOT EXISTS ${tableName} (
id bigint generated by default as identity primary key,
first_name text,
last_name text
)`
)
await query(
`INSERT INTO ${tableName} (first_name, last_name) VALUES ('Alice', 'Smith'), ('Bob', 'Jones')`
)
try {
await setupFilterBarPage(page, ref, toUrl(`/project/${ref}/editor?schema=public`))
await navigateToTable(page, ref, tableName)
await addFilter(page, ref, 'first_name', '=', 'Alice')
await expect(page.getByTestId('filter-condition-first_name')).toBeVisible()
await expect(page.getByRole('gridcell', { name: 'Alice' })).toBeVisible()
await expect(page.getByRole('gridcell', { name: 'Bob' })).not.toBeVisible()
await query(`ALTER TABLE ${tableName} DROP COLUMN first_name`)
await page.reload({ waitUntil: 'networkidle' })
await expect(page.getByText('No results found — check your filter values')).toBeVisible({
timeout: 10000,
})
await expect(page.getByText('Failed to retrieve rows from table')).not.toBeVisible()
const removeButton = page.getByRole('button', { name: 'Remove filters' })
await expect(removeButton).toBeVisible()
await removeButton.click()
await expect(page.getByRole('gridcell', { name: 'Smith' })).toBeVisible({ timeout: 10000 })
await expect(page.getByRole('gridcell', { name: 'Jones' })).toBeVisible()
await expect(
page.getByText('No results found — check your filter values')
).not.toBeVisible()
} finally {
await dropTable(tableName)
}
})
})
})