refactor(common): remove redundant providedIn: 'root' from injection tokens

Removes unnecessary declarations from injection tokens

(cherry picked from commit 8485579649)
This commit is contained in:
SkyZeroZx 2025-12-10 17:17:22 -05:00 committed by Andrew Kushnir
parent 0b90940461
commit 6d9d2b83f6
4 changed files with 5 additions and 4 deletions

View file

@ -215,7 +215,8 @@ export const HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken<readonly HttpInterce
// Should HttpClient contribute to stability automatically at all?
export const REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken<boolean>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'REQUESTS_CONTRIBUTE_TO_STABILITY' : '',
{providedIn: 'root', factory: () => true},
// Providing a factory implies that the token is provided in root by default
{factory: () => true},
);
/**

View file

@ -32,7 +32,7 @@ export const XSRF_DEFAULT_COOKIE_NAME = 'XSRF-TOKEN';
export const XSRF_COOKIE_NAME = new InjectionToken<string>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'XSRF_COOKIE_NAME' : '',
{
providedIn: 'root',
// Providing a factory implies that the token is provided in root by default
factory: () => XSRF_DEFAULT_COOKIE_NAME,
},
);

View file

@ -206,7 +206,7 @@ describe('provideHttpClient', () => {
it('should allow injection from an interceptor context', () => {
const ALPHA = new InjectionToken<string>('alpha', {
providedIn: 'root',
// Providing a factory implies that the token is provided in root by default
factory: () => 'alpha',
});
const BETA = new InjectionToken<string>('beta', {providedIn: 'root', factory: () => 'beta'});

View file

@ -17,7 +17,7 @@ import {
import {FakeNavigation} from './fake_navigation';
const FAKE_NAVIGATION = new InjectionToken<FakeNavigation>('fakeNavigation', {
providedIn: 'root',
// Providing a factory implies that the token is provided in root by default
factory: () => {
const config = inject(MOCK_PLATFORM_LOCATION_CONFIG, {optional: true});
const baseFallback = 'http://_empty_/';