How to use the react-admin.useUnselectAll function in react-admin

To help you get started, we’ve selected a few react-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github navidrome / navidrome / ui / src / common / BatchPlayButton.js View on Github external
export const BatchPlayButton = ({
  resource,
  selectedIds,
  action,
  label,
  icon,
  className,
}) => {
  const dispatch = useDispatch()
  const translate = useTranslate()
  const dataProvider = useDataProvider()
  const unselectAll = useUnselectAll()
  const notify = useNotify()

  const addToQueue = () => {
    dataProvider
      .getMany(resource, { ids: selectedIds })
      .then((response) => {
        // Add tracks to a map for easy lookup by ID, needed for the next step
        const tracks = response.data.reduce(
          (acc, cur) => ({ ...acc, [cur.id]: cur }),
          {}
        )
        // Add the tracks to the queue in the selection order
        dispatch(action(tracks, selectedIds))
      })
      .catch(() => {
        notify('ra.page.error', 'warning')
github navidrome / navidrome / ui / src / common / SongBulkActions.js View on Github external
export const SongBulkActions = (props) => {
  const classes = useStyles()
  const unselectAll = useUnselectAll()
  useEffect(() => {
    unselectAll(props.resource)
  }, [unselectAll, props.resource])
  return (
    
      }
        className={classes.button}
      />
github marmelab / react-admin / examples / simple / src / posts / ResetViewsButton.js View on Github external
const ResetViewsButton = ({ resource, selectedIds }) => {
    const notify = useNotify();
    const unselectAll = useUnselectAll();
    const refresh = useRefresh();
    const [updateMany, { loading }] = useUpdateMany(
        resource,
        selectedIds,
        { views: 0 },
        {
            onSuccess: () => {
                notify(
                    'ra.notification.updated',
                    'info',
                    { smart_count: selectedIds.length },
                    true
                );
                unselectAll(resource);
                refresh();
            },
github navidrome / navidrome / ui / src / playlist / PlaylistSongBulkActions.js View on Github external
const PlaylistSongBulkActions = ({
  playlistId,
  resource,
  onUnselectItems,
  ...rest
}) => {
  const unselectAll = useUnselectAll()
  useEffect(() => {
    unselectAll('playlistTrack')
  }, [unselectAll])

  const mappedResource = `playlist/${playlistId}/tracks`
  return (
    
      
        
      
    
  )
github navidrome / navidrome / ui / src / common / AddToPlaylistButton.js View on Github external
export const AddToPlaylistButton = ({ resource, selectedIds, className }) => {
  const translate = useTranslate()
  const dispatch = useDispatch()
  const unselectAll = useUnselectAll()

  const handleClick = () => {
    dispatch(
      openAddToPlaylist({ selectedIds, onSuccess: () => unselectAll(resource) })
    )
  }

  return (
    <button label="{translate('resources.song.actions.addToPlaylist')}" aria-haspopup="true" aria-controls="simple-menu">
      </button>