Simplify local storage access

The caching for local storage seems way over-engineered.
With this the context for the local storage is removed
and the local storage is accessed directly.

Pushed-by: k8s-git-ops<admin@cloudogu.com>
Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com>
Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
Rene Pfeuffer
2024-10-28 15:05:13 +01:00
parent 824f4224d1
commit 141e45aa06
11 changed files with 90 additions and 147 deletions

View File

@@ -17,9 +17,9 @@
import i18next from "i18next";
import { initReactI18next } from "react-i18next";
import { withI18next } from "storybook-addon-i18next";
import React, {useEffect} from "react";
import React, { useEffect } from "react";
import withApiProvider from "./withApiProvider";
import { withThemes } from 'storybook-addon-themes/react';
import { withThemes } from "storybook-addon-themes/react";
let i18n = i18next;
@@ -27,7 +27,7 @@ let i18n = i18next;
// and not for storyshots
if (!process.env.JEST_WORKER_ID) {
const Backend = require("i18next-fetch-backend");
i18n = i18n.use(Backend.default);
i18n = i18n.use(Backend);
}
i18n.use(initReactI18next).init({
@@ -58,10 +58,10 @@ export const decorators = [
},
}),
withApiProvider,
withThemes
withThemes,
];
const Decorator = ({children, themeName}) => {
const Decorator = ({ children, themeName }) => {
useEffect(() => {
const link = document.querySelector("#ui-theme");
if (link && link["data-theme"] !== themeName) {
@@ -69,7 +69,7 @@ const Decorator = ({children, themeName}) => {
link["data-theme"] = themeName;
}
}, [themeName]);
return <>{children}</>
return <>{children}</>;
};
export const parameters = {