fix: correctly initialize auto-refresh interval state from localStorage
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m7s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m7s
This commit is contained in:
@@ -26,7 +26,10 @@ const Layout = () => {
|
|||||||
|
|
||||||
const [ordersData, setOrdersData] = useState<OrderData[]>([]);
|
const [ordersData, setOrdersData] = useState<OrderData[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [refreshInterval, setRefreshInterval] = useState<number>(0);
|
const [refreshInterval, setRefreshInterval] = useState<number>(() => {
|
||||||
|
const saved = localStorage.getItem('nexstar_refresh_interval');
|
||||||
|
return saved ? Number(saved) : 0;
|
||||||
|
});
|
||||||
|
|
||||||
const loadData = async (showLoading = false) => {
|
const loadData = async (showLoading = false) => {
|
||||||
if (showLoading) setIsLoading(true);
|
if (showLoading) setIsLoading(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user