Skip to content

Commit 3c3c493

Browse files
feat: make storeKey optional 2nd argument in useUnselect, useUnselectAll
1 parent 71613b2 commit 3c3c493

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

packages/ra-core/src/controller/list/useUnselect.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import { Identifier } from '../../types';
1111
* const unselect = useUnselect('posts');
1212
* unselect([123, 456]);
1313
*/
14-
export const useUnselect = (resource?: string) => {
14+
export const useUnselect = (resource?: string, storeKey?: string) => {
1515
const [, { unselect }] = useRecordSelection(
16-
resource ? { resource } : { disableSyncWithStore: true }
16+
resource
17+
? { resource, storeKey }
18+
: { disableSyncWithStore: true, storeKey }
1719
);
1820
return useCallback(
1921
(ids: Identifier[], fromAllStoreKeys: boolean = false) => {

packages/ra-core/src/controller/list/useUnselectAll.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ import { useRecordSelection } from './useRecordSelection';
1010
* const unselectAll = useUnselectAll('posts');
1111
* unselectAll();
1212
*/
13-
export const useUnselectAll = ({
14-
resource,
15-
storeKey,
16-
}: {
17-
resource?: string;
18-
storeKey?: string;
19-
}) => {
13+
export const useUnselectAll = (resource?: string, storeKey?: string) => {
2014
const [, { clearSelection }] = useRecordSelection(
2115
resource
2216
? { resource, storeKey }

0 commit comments

Comments
 (0)