mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
fix: LogsPreviewer filter clear button values should not persist old values
This commit is contained in:
1 parent
e920f31f5b
commit
4489b73c6d
2 files changed
+23
-2
No files matched your search
@@ -175,7 +175,7 @@ function useLogsPreview(
|
||||
return { ...resolved, ...filterOverride }
|
||||
})
|
||||
} else {
|
||||
setFilters((prev) => ({ ...prev, ...newFilters, ...filterOverride }))
|
||||
setFilters({ ...newFilters, ...filterOverride })
|
||||
}
|
||||
}
|
||||
return [
|
||||
|
||||
@@ -350,9 +350,30 @@ test('filters alter generated query', async () => {
|
||||
userEvent.click(await screen.findByText(/Save/))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('select'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('500'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('599'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('200'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('299'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('where'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('and'))
|
||||
})
|
||||
|
||||
// should be able to clear the filters
|
||||
userEvent.click(await screen.findByRole('button', { name: 'Status' }))
|
||||
userEvent.click(await screen.findByRole('button', { name: 'Clear' }))
|
||||
get.mockClear()
|
||||
|
||||
userEvent.click(await screen.findByRole('button', { name: 'Status' }))
|
||||
userEvent.click(await screen.findByText(/400 codes/))
|
||||
userEvent.click(await screen.findByText(/Save/))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(get).not.toHaveBeenCalledWith(expect.stringContaining('500'))
|
||||
expect(get).not.toHaveBeenCalledWith(expect.stringContaining('599'))
|
||||
expect(get).not.toHaveBeenCalledWith(expect.stringContaining('200'))
|
||||
expect(get).not.toHaveBeenCalledWith(expect.stringContaining('299'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('400'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('499'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('where'))
|
||||
expect(get).toHaveBeenCalledWith(expect.stringContaining('and'))
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user