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 {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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue