fix: Performance degredation when multiple tabs are open
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import * as React from "react";
|
||||
import usePersistedState from "~/hooks/usePersistedState";
|
||||
|
||||
export default function useLastVisitedPath() {
|
||||
const [lastVisitedPath, setLastVisitedPath] = usePersistedState(
|
||||
/**
|
||||
* Hook to set locally and return the path that the user last visited. This is
|
||||
* used to redirect the user back to the last page they were on if preferred.
|
||||
*
|
||||
* @returns A tuple of the last visited path and a method to set it.
|
||||
*/
|
||||
export default function useLastVisitedPath(): [string, (path: string) => void] {
|
||||
const [lastVisitedPath, setLastVisitedPath] = usePersistedState<string>(
|
||||
"lastVisitedPath",
|
||||
"/"
|
||||
"/",
|
||||
{ listen: false }
|
||||
);
|
||||
|
||||
const setPathAsLastVisitedPath = React.useCallback(
|
||||
|
||||
Reference in New Issue
Block a user