diff --git a/frontend/src/contexts/cache.tsx b/frontend/src/contexts/cache.tsx index f24c826..8d9e77b 100644 --- a/frontend/src/contexts/cache.tsx +++ b/frontend/src/contexts/cache.tsx @@ -3,30 +3,37 @@ import {ManagedViewSet, useManagedViewSet} from "../hooks/useManagedViewSet" import {WithChildren} from "../types/ExtraTypes" import {SophonUser} from "../types/SophonTypes" -// States +/** + * The contents of the {@link cacheContext}. + */ type Cache = { users?: ManagedViewSet, } -// Actions - const cacheContext = React.createContext({}) const CacheContext = cacheContext -// Hooks - +/** + * Hook to access the {@link cacheContext}. + */ export function useCacheContext(): Cache { return React.useContext(cacheContext) } -// Components - +/** + * A provider for {@link cacheContext} which fetches some resources from the Sophon instance and caches them for future use. + * + * For example, one of the stored resources is the list of all users, which is later used to map user ids to usernames. + * + * @param children + * @constructor + */ export function CacheProvider({children}: WithChildren): JSX.Element { const users = useManagedViewSet("/api/core/users/", "id") return -} \ No newline at end of file +}