Skip to content

Route freezes with Resolver getting data from Firestore in SSR #2695

@waterplea

Description

@waterplea

Version info

Angular: 11.0.2

Firebase: 8.1.1

AngularFire: 6.1.2

Other (e.g. Ionic/Cordova, Node, browser, operating system): Chrome 87, Windows 10, Angular Universal, Node 12.14.1

How to reproduce these conditions

  1. Create Angular Universal app with Firebase
  2. Add Resolver that fetches data from Firestore to a lazy route
  3. Try navigating to that route in SSR
    resolve({params}: ActivatedRouteSnapshot): Observable<any> {
        console.log('Resolver');

        return this.firestore
            .doc(params['id'])
            .get()
            .pipe(
                tap(() => console.log('Resolved')),
                catchError(() => this.router.navigate(['']) && EMPTY),
            );
    }

I also added console.log('Constructor') in that route's component constructor.

Debug output

Console logs print out correctly:

Resolver
Resolved
Constructor

Expected behavior

Route opens with resolved data

Actual behavior

Route is stuck on loading, server does not return the page

Here comes the weird part

There's a very strange way to kick-start it :)

  1. Replace doc with collection in Resolver
  2. Add some other request to Firestore in route's component (doesn't matter doc or collection)
  3. Use async pipe in template to show that new request's result

I'm very confused.

It's hard to provide a reproduction, because it's SSR. I'll be happy to show it in my app if somebody is willing to live chat, it's pretty straightforward.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions