Revision 9894278e712a50079af87898a63e1d19a462d015 authored by Andrew Kushnir on 17 April 2024, 00:10:08 UTC, committed by Alex Rickabaugh on 22 April 2024, 19:01:36 UTC
`RouterOutlet` uses a unique injector logic that returns a value that correspond to the `ActivatedRoute` token dynamically. This logic breaks when a component/directive/pipe that injects the `ActivatedRoute` is located within a `@defer` block, because defer creates an `EnvironmentInjector` instance, which doesn't have that dynamic logic.

We've added some special handling of the `OutletInjector` in one of the previous commits, but it was incomplete and it was not covering cases when different routes use the same component. This commit updates defer logic to re-establish this dynamic behavior for `ActivatedRoute` by creating an instance of the `OutletInjector` when a parent injector was also an instance of `OutletInjector`.

This fix is a short-term solution and longer term we should find a way to achieve the dynamic behavior that Router relies on, but without adding a special case logic into defer.

Resolves #54864.

PR Close #55374
1 parent aea5f05
Raw File
browser-providers.conf.js
/**
 * @license
 * Copyright Google LLC All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

// Unique place to configure the browsers which are used in the different CI jobs in Sauce Labs (SL)
// If the target is set to null, then the browser is not run anywhere during CI.
// If a category becomes empty (e.g. BS and required), then the corresponding job must be commented
// out in the CI configuration.
const config = {
  'Android11': {unitTest: {target: 'SL', required: true}},
  'Android12': {unitTest: {target: 'SL', required: true}},
};

/** Whether browsers should be remotely acquired in debug mode. */
const debugMode = false;

// Specific platform configuration can be found at:
// https://saucelabs.com/platform/platform-configurator
const customLaunchers = {
  'SL_ANDROID11': {
    base: 'SauceLabs',
    browserName: 'Chrome',
    platformName: 'Android',
    platformVersion: '11.0',
    deviceName: 'Google Pixel 3a GoogleAPI Emulator',
    appiumVersion: '1.20.2',
    extendedDebugging: debugMode,
  },
  'SL_ANDROID12': {
    base: 'SauceLabs',
    browserName: 'Chrome',
    platformName: 'Android',
    platformVersion: '12.0',
    deviceName: 'Google Pixel 4a (5G) GoogleAPI Emulator',
    appiumVersion: '1.22.1',
    extendedDebugging: debugMode,
  },
};

const sauceAliases = {
  'CI_REQUIRED': buildConfiguration('unitTest', 'SL', true),
  'CI_OPTIONAL': buildConfiguration('unitTest', 'SL', false)
};

module.exports = {
  customLaunchers : customLaunchers,
  sauceAliases : sauceAliases,
};

function buildConfiguration(type, target, required) {
  return Object.keys(config)
      .filter((item) => {
        const conf = config[item][type];
        return conf.required === required && conf.target === target;
      })
      .map((item) => target + '_' + item.toUpperCase());
}
back to top