Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 332x 1658x 1658x | import React from "react";
import { QueryClientsContext } from "~app/contexts/query-clients-context";
import type { QueryClientsRecord } from "~app/contexts/query-clients-context";
import { QueryProvider } from "~app/providers/query";
import type { I18nContext } from "~app/utils/i18n";
type Props = {
getQueryClientsRecord: () => QueryClientsRecord;
initialQueryClientKey: keyof QueryClientsRecord;
i18nContext: I18nContext;
};
export const OuterProvider: React.FC<React.PropsWithChildren<Props>> = ({
children,
getQueryClientsRecord,
initialQueryClientKey,
i18nContext,
}) => {
// We're doing useState instead of useMemo
// Because we don't want to rerender Wrap on every queryClient change
// oxlint-disable-next-line react/hook-use-state
const queryClientsState = React.useState<QueryClientsRecord>(
getQueryClientsRecord,
);
return (
<i18nContext.Provider>
<QueryClientsContext value={queryClientsState}>
<QueryProvider queryClientKey={initialQueryClientKey}>
{children}
</QueryProvider>
</QueryClientsContext>
</i18nContext.Provider>
);
};
|