Skip to content

RouterOutlet loads component 2x in a race condition #7497

Closed

Description

@tbosch

RouterOutlet#reuse checks if there is no current _componentRef and in that case creates a new component.
However, _componentRef is not set until the call to DynamicComponentLoader.loadNextToLocation is finished (in RouterOutlet#activate). If that call takes a bit longer (e.g. loading an html file from the server) RouterOutlet will create 2 instances of the component.

On my branch for codegen templates that changes the timing of DynamicComponentLoading a bit, the test for syncRoutesWithDynamicComponents (in sync_route_spec_impl.ts) fails because of this.

Activity

  1. tbosch commented on Mar 9, 2016

    @tbosch
    ContributorAuthor

    Setting to P1 as the issue the commit that introduced this logic was marked as P0... (#7318)

  2. naomiblack commented on Mar 10, 2016

    @naomiblack
    Contributor

    @mhevery can you figure out who should work on this one? It seems to be related to #7318. Tests for the codegen branch are failing because of this issue.

  3. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  4. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions