How to use the react-admin.useRefresh 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 sony / nmos-js / Development / src / pages / receivers / ReceiversShow.js View on Github external
const ConnectionManagementTab = ({
    controllerProps,
    receiverData,
    ...props
}) => {
    const notify = useNotify();
    const refreshWholeView = useRefresh();
    // we need to force update the sender data without refreshing
    // the whole view
    const [refresh, setRefresh] = useState(true);
    const [filter, setFilter] = useState({
        transport: get(receiverData, 'transport'),
    });
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination } = useGetList({
        ...props,
        filter,
        paginationURL,
        resource: 'senders',
        refresh,
    });

    // receiverData initialises undefined, update when no longer null
github sony / nmos-js / Development / src / pages / senders / SendersList.js View on Github external
const SendersList = props => {
    const refresh = useRefresh();
    const [filter, setFilter] = useState({});
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination, url } = useGetList({
        ...props,
        filter,
        paginationURL,
    });
    if (!loaded) return ;
    if (!data) return null;

    const nextPage = label => {
        setPaginationURL(pagination[label]);
    };

    const changeFilter = (filterValue, name) => {
        let currentFilter = filter;
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();
            },
            onFailure: error =>
github sony / nmos-js / Development / src / pages / sources / SourcesList.js View on Github external
const SourcesList = props => {
    const refresh = useRefresh();
    const [filter, setFilter] = useState({});
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination, url } = useGetList({
        ...props,
        filter,
        paginationURL,
    });
    if (!loaded) return ;

    const nextPage = label => {
        setPaginationURL(pagination[label]);
    };

    const changeFilter = (filterValue, name) => {
        let currentFilter = filter;
        if (filterValue) {
github navidrome / navidrome / ui / src / user / UserEdit.js View on Github external
const UserEdit = (props) => {
  const { permissions } = props
  const translate = useTranslate()
  const [mutate] = useMutation()
  const notify = useNotify()
  const redirect = useRedirect()
  const refresh = useRefresh()

  const isMyself = props.id === localStorage.getItem('userId')
  const getNameHelperText = () =>
    isMyself && {
      helperText: translate('resources.user.helperTexts.name'),
    }
  const canDelete = permissions === 'admin' && !isMyself

  const save = useCallback(
    async (values) => {
      try {
        await mutate(
          {
            type: 'update',
            resource: 'user',
            payload: { id: values.id, data: values },
github sony / nmos-js / Development / src / pages / receivers / ReceiversList.js View on Github external
const ReceiversList = props => {
    const refresh = useRefresh();
    const [filter, setFilter] = useState({});
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination, url } = useGetList({
        ...props,
        filter,
        paginationURL,
    });
    if (!loaded) return ;

    const nextPage = label => {
        setPaginationURL(pagination[label]);
    };

    const changeFilter = (filterValue, name) => {
        let currentFilter = filter;
        if (filterValue) {
github sony / nmos-js / Development / src / pages / menu.js View on Github external
const NavLinkMenuItem = ({
    to,
    icon,
    label = titleCase(to.substr(1)),
    ...props
}) => {
    const history = useHistory();
    const refresh = useRefresh();
    const refreshHandler = () => {
        if (window.location.hash.substr(1) === to) {
            refresh();
        } else {
            history.push(to);
        }
    };
    return (
        
            {icon}
            
        
    );
github sony / nmos-js / Development / src / pages / nodes / NodesList.js View on Github external
const NodesList = props => {
    const refresh = useRefresh();
    const [filter, setFilter] = useState({});
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination, url } = useGetList({
        ...props,
        filter,
        paginationURL,
    });
    if (!loaded) return ;

    const nextPage = label => {
        setPaginationURL(pagination[label]);
    };

    const changeFilter = (filterValue, name) => {
        let currentFilter = filter;
        if (filterValue) {
github navidrome / navidrome / ui / src / playlist / PlaylistSongs.js View on Github external
const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
  const listContext = useListContext()
  const { data, ids, onUnselectItems } = listContext
  const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
  const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
  const classes = useStyles({ isDesktop })
  const dispatch = useDispatch()
  const dataProvider = useDataProvider()
  const refresh = useRefresh()
  const notify = useNotify()
  const version = useVersion()

  const onAddToPlaylist = useCallback(
    (pls) => {
      if (pls.id === playlistId) {
        refresh()
      }
    },
    [playlistId, refresh]
  )

  const reorder = useCallback(
    (playlistId, id, newPos) => {
      dataProvider
        .update('playlistTrack', {
github sony / nmos-js / Development / src / pages / subscriptions / SubscriptionsList.js View on Github external
const SubscriptionsList = props => {
    const refresh = useRefresh();
    const [filter, setFilter] = useState({});
    const [paginationURL, setPaginationURL] = useState(null);
    const { data, loaded, pagination, url } = useGetList({
        ...props,
        filter,
        paginationURL,
    });
    if (!loaded) return ;

    const nextPage = label => {
        setPaginationURL(pagination[label]);
    };

    const changeFilter = (filterValue, name) => {
        let currentFilter = filter;
        if (filterValue) {