This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react"; | |
import { useLocation } from "react-router"; | |
import { useNavigate } from "react-router-dom"; | |
import { useLocalStorage } from "usehooks-ts"; | |
// A hook to save last search query and load it again when `loadLastSearch` is received in location state | |
// Useful to save table state and load it when user click on custom in-page back button | |
export const useLastSearch = (key: string, isDisabled?: boolean) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext, useContext, useEffect, useRef, useState } from "react"; | |
import { useSearchParams } from "react-router-dom"; | |
const ISO_8601 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/; | |
const isFalsy = (value: any) => | |
!value || | |
JSON.stringify(value) === "{}" || | |
(Array.isArray(value) && value.length === 0); |