components icon indicating copy to clipboard operation
components copied to clipboard

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

Open bivs06 opened this issue 2 years ago • 1 comments

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):

bivs06 avatar May 23 '22 12:05 bivs06

Hi all, news for this bug?

fra-ita avatar Nov 23 '22 08:11 fra-ita

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?

Any update on this issue?

jonesprabu avatar Nov 28 '23 02:11 jonesprabu

Any update on this issue?

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

jonesprabu avatar Jan 16 '24 16:01 jonesprabu

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

jonesprabu avatar Jan 16 '24 16:01 jonesprabu

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

SkyZeroZx avatar Jul 09 '24 03:07 SkyZeroZx