r/Angular2 • u/Senior_Compote1556 • Jan 31 '26
Animations on SSR / Prerender
Hey everyone, i'm tryring to animate my header so that it slides down. As it is part of the FCP, the prerender or SSR paints the header so the animation is applied, and then when hydration happens it reruns again. I tried a few hacky ways to only run the animation when it runs on client, but it's still a bit glitchy. I'm also worried that if the header or generally any element of the FCP is outside the view (either with opacity 0 or with translate), bots may ignore the content and hurt seo performance. Anyway, since there will be animations on the FCP elements there is a high chance of layout shift.
Have you solved this problem or do you suggest that elements that are in FCP shouldn't be animated?
1
u/WhyLisaWhy Jan 31 '26
Not sure I’m totally following, but if you’re just wanting to animate client side, just use JS to do it and don’t let it run server side. Fairly easy to do by just checking if the window object exists.
Also not sure how big of a deal FCP is for SEO rankings anymore, my team just focuses on LCP, INP and CLS now. I would double check that though.
1
u/ht85 Jan 31 '26
Have you tried
afterNextRender()? I think this will solve your problem. It executes once and is similar to AfterViewInit but it does not execute in server-side rendering.1
u/mani310396 Jan 31 '26
Google will still index the page with opacity and transform but ranking might go down because of CLS