Skip to content

Inconsistent router state on data resolvers in secondary router outlets #52892

@leonelvsc

Description

@leonelvsc

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

Yes

Description

I've the following router state wich is inconsistent, this started to happen after upgrade to angular 17

There is one resolver configured for this route but the data object resolved from the observable of the activated route recieves an object without the resolver property

Screenshot from 2023-11-14 11-54-34

Route config:

{
      path: 'cliente-venta/:id',
      runGuardsAndResolvers: 'always',
      resolve: {
        objeto: ParameterResolverService
      },
      data: {
        modulo: MODULO
      },
      component: CajaVentaComponent,
      outlet: 'modal'
    }

if i do change the route def to

{
      path: 'cliente-venta/:id',
      runGuardsAndResolvers: 'always',
      resolve: {
        objeto: ParameterResolverService
      },
      data: {
        modulo: MODULO,
        objeto: {a: 'property'}
      },
      component: CajaVentaComponent,
      outlet: 'modal'
    }

I recieve that static object instead of the resolved one from the resolver

Please provide a link to a minimal reproduction of the bug

Reproduction click "Go to secondary" and see the console:

With the probem ( adding an empty route of path: '' without component )
https://stackblitz.com/edit/stackblitz-starters-rvkqef

Without the problem
https://stackblitz.com/edit/stackblitz-starters-ayxe72

Please provide the environment you discovered this bug in (run ng version)

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.0.0
Node: 18.18.2
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0
@angular-devkit/build-angular   17.0.0
@angular-devkit/build-webpack   0.1700.0
@angular-devkit/core            17.0.0
@angular-devkit/schematics      17.0.0
@angular/cli                    17.0.0
@angular/fire                   17.0.0-next.0
@schematics/angular             17.0.0
ng-packagr                      17.0.0
rxjs                            7.8.1
typescript                      5.2.2
webpack                         5.89.0
zone.js                         0.14.2

Anything else?

There should be ideally a test case for this type of configurations, in the past empty path routes have also caused problems

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: routerneeds reproductionThis issue needs a reproduction in order for the team to investigate further

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions