when an element is hidden - are any network requests still fulfilled in SSR?
If you hide it by turning off rendering, instead of simply making it not visible, then it won’t run at all and won’t load data
Also, just to be clear, this is about the fetcher/loader components, not the display components like ProductField
does this work differently in preview mode vs production?
No it should not work differently, preview mode uses the same code gen as production
so i have a component that has 3 single-select states
each state toggles visibility on an element that has a network request inside of it
the master component i have all 3 subviews as Not Visible
, and changing state sets them to visible.
but when changing it’s state like:
<PlasmicComponent component="Nav Category" componentProps={{ category: state.category}} />
there’s a hesitation in loading and i see all the network requests stack up each time the category changes
i should say - these network requests are coming from ProductBox
Just so I understand, you are saying that things are working as expected when you just rely on the visibility setting, but when you pass a category in as the props, you see loading?
If the category you are passing in is changing, then that would trigger a new client side load unless it was a previously cached category
well the category is what toggles the visibility
so on first-load i can’t wait each time (it’s a navigation). any suggestions?
Can you point me to which project / component you are seeing this in?
you betcha - thank you mRKWSMy8wyKwe3EjpDLbA
the Navigation Category
component
I thought by setting them as Not Visible
in the main component - they would still fetch, and toggling them wouldn’t cause re-fetch
I took a quick look and (like you) I don’t expect there to be any network loads to be happening, but I do still see them firing in preview mode - we’ll dig into this a bit deeper this week, thanks for reporting
confirmed the same in production
any updates on this? Or potentially any workarounds?