fix: don't cache/store the providers, we only use in 1 place currently and we can memo it

This commit is contained in:
Derrick Hammer 2024-03-26 12:58:16 -04:00
parent 849b723e8c
commit 5bdd888f63
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 10 deletions

View File

@ -5,26 +5,19 @@ import {accountProvider} from "~/data/account-provider.js";
import type {SdkProvider} from "~/data/sdk-provider.js";
import {createPortalAuthProvider} from "~/data/auth-provider.js";
interface DataProviders {
export interface DataProviders {
default: SdkProvider;
auth: AuthProvider;
[key: string]: SdkProvider | AuthProvider;
}
let providers: DataProviders;
export function getProviders(sdk: Sdk) {
if (providers) {
return providers;
}
accountProvider.sdk = sdk;
fileProvider.sdk = sdk;
providers = {
return {
default: accountProvider,
auth: createPortalAuthProvider(sdk),
files: fileProvider,
};
return providers;
}