Skip to content

Commit 5bb8fb6

Browse files
committed
refactor(store): inline NGXS_EXECUTION_STRATEGY factory
1 parent 81c7a7c commit 5bb8fb6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/store/src/execution/symbols.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import { InjectionToken, inject } from '@angular/core';
33
import { NGXS_OPTIONS } from '../symbols';
44

55
/**
6-
* The injection token is used internally to resolve an instance of the execution
7-
* strategy. It checks whether consumers have provided their own `executionStrategy`
8-
* and also verifies if we are operating in a zone-aware environment.
6+
* The injection token is used internally to resolve an instance of the execution strategy.
97
*/
108
export const NGXS_EXECUTION_STRATEGY = new InjectionToken<NgxsExecutionStrategy>(
119
typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_EXECUTION_STRATEGY' : '',
1210
{
1311
providedIn: 'root',
14-
factory: () => {
15-
const options = inject(NGXS_OPTIONS);
16-
return inject(options.executionStrategy!);
17-
}
12+
// Since `executionStrategy` is a `Type<...>`, we should inject it to retrieve an
13+
// instance. This injection token essentially holds an instance of the
14+
// execution strategy class.
15+
factory: () => inject(inject(NGXS_OPTIONS).executionStrategy)
1816
}
1917
);
2018

0 commit comments

Comments
 (0)