not smooth still but decent enough
This commit is contained in:
@@ -19,11 +19,12 @@ export default function ProtectedRoute({
|
|||||||
isError: serverFailure,
|
isError: serverFailure,
|
||||||
isLoading: serverLoading,
|
isLoading: serverLoading,
|
||||||
isSuccess: isServerHealthy,
|
isSuccess: isServerHealthy,
|
||||||
error,
|
error: serverStatusError,
|
||||||
} = useServerCheck();
|
} = useServerCheck();
|
||||||
|
|
||||||
const { isLoading, isError, isFetching, isSuccess, refetch } =
|
const { isLoading, isError, isFetching, isSuccess, refetch } = useAuthCheck(
|
||||||
useAuthCheck(isServerHealthy);
|
!serverLoading
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// on load of this, if we already have jwt tokens in store,
|
// 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 SocketChannels from "@nirvana/core/sockets/channels";
|
||||||
import { User } from "@nirvana/core/models";
|
import { User } from "@nirvana/core/models";
|
||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
|
import { queryClient } from "../pages/nirvanaApp";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
@@ -33,10 +34,15 @@ export function LineDataProvider({ children }) {
|
|||||||
query: { token: jwtToken },
|
query: { token: jwtToken },
|
||||||
});
|
});
|
||||||
|
|
||||||
// client-side
|
// client-side errors
|
||||||
$ws.on("connect_error", (err) => {
|
$ws.on("connect_error", (err) => {
|
||||||
console.error(err.message); // prints the message associated with the error
|
console.error(err.message); // prints the message associated with the error
|
||||||
toast.error("sorry...this is our bad...please refresh with cmd + r");
|
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");
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user