Fix initial load breaking.

This commit is contained in:
2025-12-13 15:26:56 -05:00
parent a1fc19b202
commit 58e3fb73b1
5 changed files with 22 additions and 15 deletions

View File

@@ -18,12 +18,12 @@ import LinksDeletedChart from "./LinksDeletedChart";
import { LineChartArr } from "@/types/LineChartStats";
import CommandResponsesChart from "./CommandResponsesChart";
import TimedTriggeredChart from "./TimesTriggeredChart";
import GetStatsRange from "@/graphql/queries/getStatsRange";
import Image from "next/image";
import StatsList from "./StatsList";
import GetTotalGroupsQuery from "@/graphql/queries/getTotalGroups";
import GetTotalStatsQuery from "@/graphql/queries/getTotalStats";
import GetTodaysStatsQuery from "@/graphql/queries/getTodaysStats";
import Image from "next/image";
import GetStatsRange from "@/graphql/queries/getStatsRange";
export default function Home() {
// * Total Groups * //
@@ -57,12 +57,14 @@ export default function Home() {
// * 30 Day Stats * //
// Dates
const [currDate, setCurrDate] = useState<Date>();
const [date30DaysAgo, setDate30DaysAgo] = useState<Date>();
const [currDate, setCurrDate] = useState<String>();
const [date30DaysAgo, setDate30DaysAgo] = useState<String>();
useEffect(() => {
setCurrDate(new Date());
setDate30DaysAgo(new Date(new Date().setDate(new Date().getDay() - 30)));
setCurrDate(new Date().toJSON());
setDate30DaysAgo(
new Date(new Date().setDate(new Date().getDay() - 30)).toJSON()
);
}, []);
const [
@@ -74,8 +76,8 @@ export default function Home() {
] = useQuery({
query: GetStatsRange,
variables: {
stateDate: currDate,
endDate: date30DaysAgo
startDate: currDate || "",
endDate: date30DaysAgo || ""
}
});