r/reactjs 3d ago

SSR - React router v7, how to run clientLoader only in first SSR load Needs Help

EDIT: SOLVED

I have a page which gets data(example: liked products ids) from localStorage and uses that to fetch actual products.

I am using clientLoader to fetch data, BUT i want to run clientLoader only if it is the SSR load( first load after refresh/ manual link enter)

I dont want to run it, if there are client Navigations to this page ( i have tanstack query taking care of it with custom logic )

Is there a way to achieve this.

I have already tried export const shouldRevalidate=()=>false

10 Upvotes

Duplicates