angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.73k forks source link

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

Open bivs06 opened 2 years ago

bivs06 commented 2 years ago

Is this a regression?

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

fra-ita commented 1 year ago

Hi all, news for this bug?

philipp-schaerer-lambdait commented 1 year ago

I'm having the same issue. Is it even possible to get *cdkVirtualFor to render something in SSR? Shouldn't it at least be possible to prerender an item list which has a fixed item size on every viewport width?

jonesprabu commented 9 months ago

Any update on this issue?

jonesprabu commented 8 months ago

Any update on this issue?

Please provide some updates or any help with any workaround or alternative is highly appreciated. Thanks!!!

jonesprabu commented 8 months ago

As per the code CDK virtual scroll will not support SSR, did I miss spotting this anywhere on the docs page? If not why it is not explicitly mentioned anywhere? image

SkyZeroZx commented 2 months ago

Same error in my case when i need add Virtual CDK Scroll throw error with SSR and in doc not mention only working in browser image