diff --git a/src/utils/contexts/color.jsx b/src/utils/contexts/color.jsx index f75ced94f..d779a58b6 100644 --- a/src/utils/contexts/color.jsx +++ b/src/utils/contexts/color.jsx @@ -30,10 +30,6 @@ export function ColorProvider({ initialTheme, children }) { lastColor = rawColor; }; - useEffect(() => { - if (initialTheme !== undefined) setColor(initialTheme ?? getInitialColor()); - }, [initialTheme]); - useEffect(() => { rawSetColor(color); }, [color]); diff --git a/src/utils/contexts/tab.jsx b/src/utils/contexts/tab.jsx index c18fc2c94..316f43d72 100644 --- a/src/utils/contexts/tab.jsx +++ b/src/utils/contexts/tab.jsx @@ -1,14 +1,10 @@ -import { createContext, useEffect, useMemo, useState } from "react"; +import { createContext, useMemo, useState } from "react"; export const TabContext = createContext(); export function TabProvider({ initialTab, children }) { const [activeTab, setActiveTab] = useState(() => initialTab ?? false); - useEffect(() => { - if (initialTab !== undefined) setActiveTab(initialTab ?? false); - }, [initialTab]); - const value = useMemo(() => ({ activeTab, setActiveTab }), [activeTab]); return {children}; diff --git a/src/utils/contexts/theme.jsx b/src/utils/contexts/theme.jsx index 81acff46a..3e4436ab5 100644 --- a/src/utils/contexts/theme.jsx +++ b/src/utils/contexts/theme.jsx @@ -31,10 +31,6 @@ export function ThemeProvider({ initialTheme, children }) { localStorage.setItem("theme-mode", rawTheme); }; - useEffect(() => { - if (initialTheme !== undefined) setTheme(initialTheme ?? getInitialTheme()); - }, [initialTheme]); - useEffect(() => { rawSetTheme(theme); }, [theme]); diff --git a/src/widgets/calendar/component.jsx b/src/widgets/calendar/component.jsx index 7c4b7c709..e64076a29 100644 --- a/src/widgets/calendar/component.jsx +++ b/src/widgets/calendar/component.jsx @@ -2,7 +2,7 @@ import Container from "components/services/widget/container"; import { DateTime } from "luxon"; import { useTranslation } from "next-i18next/pages"; import dynamic from "next/dynamic"; -import { useContext, useEffect, useMemo, useState } from "react"; +import { useContext, useMemo, useState } from "react"; import { SettingsContext } from "utils/contexts/settings"; import Agenda from "./agenda"; @@ -38,18 +38,12 @@ const colorVariants = { export default function Component({ service }) { const { widget } = service; const { i18n } = useTranslation(); - const [showDate, setShowDate] = useState(null); const [events, setEvents] = useState({}); const nowDate = DateTime.now().setLocale(i18n.language); const currentDate = widget?.timezone ? nowDate.setZone(widget?.timezone).startOf("day") : nowDate; + const [showDate, setShowDate] = useState(currentDate); const { settings } = useContext(SettingsContext); - useEffect(() => { - if (!showDate) { - setShowDate(currentDate); - } - }, [showDate, currentDate]); - // params for API fetch const params = useMemo(() => { const constructedParams = {