How to use the react-query.queryCache.invalidateQueries function in react-query

To help you get started, we’ve selected a few react-query 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 Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / polls / submit / SubmitPoll.tsx View on Github external
onSuccess: () => {
      queryCache.invalidateQueries(["polls.list"]);
      queryCache.invalidateQueries(["polls.stats"]);
      sendSuccessToast("Sondage envoyé.");
    },
    onError: (errorAsUnknown) => {
github exercism / website / app / javascript / components / dropdowns / Notifications.tsx View on Github external
useEffect(() => {
    if (!listAttributes.hidden) {
      return
    }

    queryCache.invalidateQueries(CACHE_KEY).then(() => {
      if (!isMountedRef.current) {
        return
      }

      setIsStale(false)
    })
  }, [listAttributes.hidden, isStale, isMountedRef])
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / associations / marketplace / counter / CounterOrderMaker.tsx View on Github external
newBasket[product.id].status = "error";
        setBasket(newBasket);

        sendErrorToast(`Erreur lors du passage de la commande : ${e}`);

        error = true;
      }
    }

    if (!error) {
      setBasket({});
      resetCustomer();
      sendSuccessToast("Commande passée avec succès");
    }

    await queryCache.invalidateQueries("marketplace.transactions.list");
  };
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / associations / events / list / EventCard.tsx View on Github external
onSuccess: () => {
      queryCache.invalidateQueries(["events.list"]);
      sendSuccessToast("Inscription effectuée.");
    },
    onError: (errorAsUnknown) => {
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / settings / associations / SettingsAssociationsAdd.tsx View on Github external
onSuccess: () => {
      queryCache.invalidateQueries(["associations.list"]);
      sendSuccessToast("Association créée.");
      history.push(`/parametres/associations`);
    },
    onError: (errorAsUnknown) => {
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / associations / settings / AssociationLogoSettings.tsx View on Github external
api.associations.setLogo(association.id, media?.id || null).then(() => {
      queryCache.invalidateQueries("association.get");
    });
  };
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / settings / associations / SettingsAssociationsEdit.tsx View on Github external
onSuccess: () => {
      queryCache.invalidateQueries(["associations.get"]);
      sendSuccessToast("Association modifiée.");
    },
    onError: (errorAsUnknown) => {
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / associations / roles / administration / EditRoleModal.tsx View on Github external
onSuccess: () => {
      queryCache.invalidateQueries(["roles.list"]);
      sendSuccessToast("Rôle modifié.");
    },
    onError: (errorAsUnknown) => {
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / associations / library / home / LoanableCard.tsx View on Github external
onSuccess: () => {
      sendSuccessToast("Demande annulée.");
      queryCache.invalidateQueries("loanables.list");
    },
    onError: () => sendErrorToast("L’annulation a échoué."),