mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
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:
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 |
@@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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 }),
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user