Clear relay cache on login

This commit is contained in:
Jonathan
2025-06-14 00:02:25 +02:00
committed by Bryan Frimin
parent 20fc71e9dd
commit 8538fe0421
2 changed files with 9 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ import { useTranslate } from "@probo/i18n";
import { Button, Field, useToast } from "@probo/ui";
import type { FormEventHandler } from "react";
import { Link, useNavigate } from "react-router";
import { clearRelayStore } from "/providers/RelayProviders";
export default function LoginPage() {
const { __ } = useTranslate();
@@ -26,7 +27,7 @@ export default function LoginPage() {
const error = await res.json();
throw new Error(error.message || __("Failed to login"));
}
clearRelayStore();
navigate("/");
})
.catch((e) => {

View File

@@ -119,6 +119,13 @@ export const relayEnvironment = new Environment({
store,
});
export const clearRelayStore = () => {
const source = relayEnvironment.getStore().getSource();
if (source instanceof Map) {
source.clear();
}
};
/**
* Provider for relay with the probo environment
*/