@@ -48,23 +48,24 @@ export interface DaffMagentoDriverConfig extends HttpOptions {
4848 * @param endpoint - The Magento store domain (e.g. "https://www.my-store.com/graphql") or an injection token for a string or function that returns a string
4949 */
5050export function provideMagentoDriver ( options : DaffMagentoDriverConfig | InjectionToken < DaffMagentoDriverConfig > , ...features : Array < MagentoDriverFeature > ) : EnvironmentProviders {
51- const opts : DaffMagentoDriverConfig = {
52- possibleTypes : MAGENTO_POSSIBLE_TYPES . possibleTypes ,
53- typePolicies,
54- ...( options instanceof InjectionToken ? inject ( options ) : options ) ,
55- } ;
56- const cache = new InMemoryCache ( { typePolicies : opts . typePolicies , possibleTypes : opts . possibleTypes } ) ;
5751 const providers = [
5852 ...features . flatMap ( ( { ɵproviders } ) => ɵproviders ) ,
59- provideApollo ( ( ) => ( {
60- ...inject ( DAFF_DRIVER_MAGENTO_EXTRA_APOLLO_OPTIONS ) ,
61- link : from ( [
62- ...inject ( DAFF_APOLLO_REQUEST_HANDLERS ) ,
63- onError ( inject ( DAFF_DRIVER_MAGENTO_ERROR_HANDLER ) ) ,
64- inject ( HttpLink ) . create ( opts ) ,
65- ] ) ,
66- cache,
67- } ) ) ,
53+ provideApollo ( ( ) => {
54+ const opts : DaffMagentoDriverConfig = {
55+ possibleTypes : MAGENTO_POSSIBLE_TYPES . possibleTypes ,
56+ typePolicies,
57+ ...( options instanceof InjectionToken ? inject ( options ) : options ) ,
58+ } ;
59+ return {
60+ ...inject ( DAFF_DRIVER_MAGENTO_EXTRA_APOLLO_OPTIONS ) ,
61+ link : from ( [
62+ ...inject ( DAFF_APOLLO_REQUEST_HANDLERS ) ,
63+ onError ( inject ( DAFF_DRIVER_MAGENTO_ERROR_HANDLER ) ) ,
64+ inject ( HttpLink ) . create ( opts ) ,
65+ ] ) ,
66+ cache : new InMemoryCache ( { typePolicies : opts . typePolicies , possibleTypes : opts . possibleTypes } ) ,
67+ } ;
68+ } ) ,
6869 provideDaffDriverHttpClientCacheService ( DaffDriverHttpClientCacheMagentoService ) ,
6970
7071 // enable caching by default
@@ -73,7 +74,7 @@ export function provideMagentoDriver(options: DaffMagentoDriverConfig | Injectio
7374 ] ;
7475
7576 if ( features . find ( ( { ɵkind } ) => ɵkind === MagentoDriverFeatureKind . TransferState ) ) {
76- providers . push ( provideDaffDriverMagentoTransferState ( cache ) ) ;
77+ providers . push ( provideDaffDriverMagentoTransferState ( ) ) ;
7778 }
7879
7980 return makeEnvironmentProviders ( providers ) ;
0 commit comments