fix: don't cache/store the providers, we only use in 1 place currently and we can memo it
This commit is contained in:
parent
849b723e8c
commit
5bdd888f63
|
@ -5,26 +5,19 @@ import {accountProvider} from "~/data/account-provider.js";
|
||||||
import type {SdkProvider} from "~/data/sdk-provider.js";
|
import type {SdkProvider} from "~/data/sdk-provider.js";
|
||||||
import {createPortalAuthProvider} from "~/data/auth-provider.js";
|
import {createPortalAuthProvider} from "~/data/auth-provider.js";
|
||||||
|
|
||||||
interface DataProviders {
|
export interface DataProviders {
|
||||||
default: SdkProvider;
|
default: SdkProvider;
|
||||||
auth: AuthProvider;
|
auth: AuthProvider;
|
||||||
[key: string]: SdkProvider | AuthProvider;
|
[key: string]: SdkProvider | AuthProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
let providers: DataProviders;
|
|
||||||
|
|
||||||
export function getProviders(sdk: Sdk) {
|
export function getProviders(sdk: Sdk) {
|
||||||
if (providers) {
|
|
||||||
return providers;
|
|
||||||
}
|
|
||||||
|
|
||||||
accountProvider.sdk = sdk;
|
accountProvider.sdk = sdk;
|
||||||
fileProvider.sdk = sdk;
|
fileProvider.sdk = sdk;
|
||||||
providers = {
|
|
||||||
|
return {
|
||||||
default: accountProvider,
|
default: accountProvider,
|
||||||
auth: createPortalAuthProvider(sdk),
|
auth: createPortalAuthProvider(sdk),
|
||||||
files: fileProvider,
|
files: fileProvider,
|
||||||
};
|
};
|
||||||
|
|
||||||
return providers;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue