Clear relay cache on login
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user