fix: clearing playlist search (#32167)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Paul D'Ambra
2025-05-12 18:23:00 -05:00
committed by GitHub
parent d39b70c90a
commit 92fe82d9ae
4 changed files with 16 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -169,5 +169,20 @@ describe('savedSessionRecordingPlaylistsLogic', () => {
},
})
})
it('can remove search param', async () => {
router.actions.push(urls.replay(ReplayTabs.Playlists))
await expectLogic(logic, () => {
logic.actions.setSavedPlaylistsFilters({ search: 'test', page: 1 })
logic.actions.setSavedPlaylistsFilters({ search: undefined })
}).toMatchValues({
filters: {
page: 1,
},
})
expect(router.values.searchParams).not.toHaveProperty('search')
expect(router.values.searchParams).toHaveProperty('page', 1)
})
})
})

View File

@@ -74,9 +74,8 @@ export const savedSessionRecordingPlaylistsLogic = kea<savedSessionRecordingPlay
{
setSavedPlaylistsFilters: (state, { filters }) =>
objectClean({
...(state || {}),
...Object.fromEntries(Object.entries(state || {}).filter(([key]) => key in filters)),
...filters,
// Reset page on filter change EXCEPT if it's page that's being updated
...('page' in filters ? {} : { page: 1 }),
}),
},