not smooth still but decent enough

This commit is contained in:
talksik
2022-05-06 07:06:09 -05:00
parent 70ddca4c29
commit 974a5a40fb
2 changed files with 11 additions and 4 deletions
@@ -19,11 +19,12 @@ export default function ProtectedRoute({
isError: serverFailure,
isLoading: serverLoading,
isSuccess: isServerHealthy,
error,
error: serverStatusError,
} = useServerCheck();
const { isLoading, isError, isFetching, isSuccess, refetch } =
useAuthCheck(isServerHealthy);
const { isLoading, isError, isFetching, isSuccess, refetch } = useAuthCheck(
!serverLoading
);
useEffect(() => {
// on load of this, if we already have jwt tokens in store,
@@ -5,6 +5,7 @@ import MasterLineData from "@nirvana/core/models/masterLineData.model";
import SocketChannels from "@nirvana/core/sockets/channels";
import { User } from "@nirvana/core/models";
import { io } from "socket.io-client";
import { queryClient } from "../pages/nirvanaApp";
import toast from "react-hot-toast";
import { useEffect } from "react";
import { useRecoilValue } from "recoil";
@@ -33,10 +34,15 @@ export function LineDataProvider({ children }) {
query: { token: jwtToken },
});
// client-side
// client-side errors
$ws.on("connect_error", (err) => {
console.error(err.message); // prints the message associated with the error
toast.error("sorry...this is our bad...please refresh with cmd + r");
// force refetch of server status as well as these generally go hand in hand
// this should overall remount this component currently which is what we want for new data
queryClient.invalidateQueries("SERVER_CHECK");
});
}, []);