question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page is getting generated without data

See original GitHub issue

🐞 Bug report

I have read access on services but page is getting generated without data

Description

Below is angular code. Getting called in ngInit

this.subSink.add(
      this.faqService.getAll().subscribe(
        (f) => {
          this.panels = f.map((x) => ({ active: false, ...x }));
        },
        (error) => {
          console.error(error);
        }
      )
    );

faq service is fetching data from firestore. That have universal read access.

🔬 Minimal Reproduction

💻Your Environment

Angular Version:




11.0.9

Scully Version:




^1.0.0

🔥 Exception or Error




Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SanderEliascommented, Jan 28, 2021

@kunjee17 The problem is that your firebase driver runs outside of ngZone. Because of that, Scully does extract the HTML before the data is available. For use-cases like this, we have a manualIdle control. That way, you can tell Scully when the page is ready. I did a PR to your reproduction that show how that would work. first I updated your component to this:

@Component({
  selector: 'app-faq',
  templateUrl: './faq.component.html',
  styleUrls: ['./faq.component.less'],
})
export class FaqComponent {
  loading = true;
  panels$ = this.tss
    .useScullyTransferState(
      'faq',
      this.faqService.getAll().pipe(
        take(1), // as it is hot, we need to take only the first one
        /**
         * as firebase runs outside of zone, we need to manually tell Scully the page is "ready"
         * the setTimeout makes sure Angular has some time to paint the page, before we
         * will "scrape"
         */
        tap(() => setTimeout(() =>this.ims.fireManualMyAppReadyEvent(),10)), //
      )
    )
    .pipe(
      tap(() => (this.loading = false)),
      /** if you want to subscribe to future updates you can merge the 'hot'
       * service back in, or use a subject to push to. */
      // mergeMap(()=> this.faqService.getAll()),
      map((faq) => faq.map((x) => ({ active: false, ...x } as Panel)))
    );
  constructor(
    private faqService: FaqService,
    private tss: TransferStateService,
    private ims: IdleMonitorService
  ) {}
}

And in your config file I updated the route to use ManualIdele checking. like this:

  routes: {
    '/faq': {
      type: 'default',
      manualIdleCheck: true
   },
  },

After those changes, your app works like expected. I’m going to close this issue because there is no action Scully can take. I will reopen the issue if there is a reason to do so! Feel free to keep discussing in here. If you have more issues, don’t hesitate to open up a new issue.

1reaction
SanderEliascommented, Jan 28, 2021

@kunjee17 I’l work on this after I finish my current task

Read more comments on GitHub >

github_iconTop Results From Across the Web

ssrs generates blank extra page when no data is selected
The problem occurs when there is no data for a tab (unique report). The message I want for no rows does show up,...
Read more >
Basic Features: Pages - Next.js
In Next.js, you can statically generate pages with or without data. Let's take a look at each case. Static Generation without data. By...
Read more >
90.63% of Content Gets No Traffic From Google. And How to ...
01 90 percent pages get no organic search traffic from google 1. Sidenote. Here's a list of the top 500 pages by search...
Read more >
No Page to Display in the Viewer and Corrupted Report ...
Solution. The issue is caused by the change Report rendering now skips the generated blank pages. Use the property Report. SkipBlankPages to control...
Read more >
how to remove blank pages? - Jaspersoft Community
Hi, I'm doing a report with iReport 5.5.2 and now have the task of removing ... I generated a blank page if no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found