Fetching tags globally every 30 seconds, rather than for each usage of Tags.

This commit is contained in:
Roland 2023-04-05 14:48:13 -06:00
parent e9f820d483
commit 7a855b57cc
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
8 changed files with 30 additions and 41 deletions

View file

@ -19,7 +19,7 @@ import {Donate} from "./components/Donate";
import {useEventsInterval} from "./Events";
import {SemanticToastContainer} from "react-semantic-toasts-2";
import {FilePreviewWrapper} from "./components/FilePreview";
import {TagsContext, useTags} from "./Tags";
import {TagsContext, useTags, useTagsInterval} from "./Tags";
function PageNotFound() {
const {t} = useContext(ThemeContext);
@ -77,19 +77,23 @@ const router = createBrowserRouter(createRoutesFromElements(<Route
export default function App() {
const statusValue = useStatusInterval();
const tagsValue = useTagsInterval();
useEventsInterval();
return <ThemeWrapper>
<FilePreviewWrapper>
{/* Context and style to handle switching between mobile/computer. */}
<style>{mediaStyles}</style>
{/* Toasts can be on any page. */}
<SemanticToastContainer position='top-right'/>
<MediaContextProvider>
<StatusContext.Provider value={statusValue}>
<RouterProvider router={router}/>
</StatusContext.Provider>
</MediaContextProvider>
</FilePreviewWrapper>
<TagsContext.Provider value={tagsValue}>
<FilePreviewWrapper>
{/* Context and style to handle switching between mobile/computer. */}
<style>{mediaStyles}</style>
{/* Toasts can be on any page. */}
<SemanticToastContainer position='top-right'/>
<MediaContextProvider>
<StatusContext.Provider value={statusValue}>
<RouterProvider router={router}/>
</StatusContext.Provider>
</MediaContextProvider>
</FilePreviewWrapper>
</TagsContext.Provider>
</ThemeWrapper>
}