angular / angular/components

bug(cdk-virtual-scroll-viewport): Content not present in SSR load

Open
#24,956 7 comments 5 reactions 0 assignees View on GitHub
area: cdk/scrolling P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

When rendering a page in SSR mode, the content for the virtual scroll is not rendered. It's blank. The page works fine when rendered in the browser. Screenshot attached for the SSR load response
Screenshot 2022-05-23 at 4 31 22 PM
:

### Reproduction

Steps to reproduce:
1. Clone the repo https://github.com/bivs06/angular-universal-ssr-bug
2. Run `npm run dev:ssr`
3. Check the response in the network tab

StackBlitz link: https://stackblitz.com/edit/angular-ivy-kfyv87?file=src%2Fapp%2Fapp.component.html

### Expected Behavior

The items for virtual scroll should load in SSR load

### Actual Behavior

The items for the virtual scroll are not loading in the SSR load

### Environment

- Angular:
- CDK/scrolling:
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):

Contributor guide

Open the contributing guide

Research direction

Clone the linked angular-universal-ssr-bug repository and run `npm run dev:ssr`; compare the network response with the browser-rendered page. Start with the reproduction in `src/app/app.component.html` from the StackBlitz link and the `cdk-virtual-scroll-viewport` behavior. Done means the virtual-scroll items appear in the SSR response as well as in the browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.