Saw this in the documentation-
My initial expectation from the names clientFetcher and serverFetcher API was that serverFetcher will run on server (so I can fetch some initial data) and then clientFetcher runs post mount where I can fetch some additional data different from what I have on server.
From the current behaviour, it seems like these are more of a getInitialClientData / getInitialServerData kind of functions which let you set the initial data and depending on navigation / load / back button click / etc, either one of them is executed.
Case 1: I define clientFetcher and serverFetcher both
In this case I was wondering, in which scenarios would you want your page to look different if it's page load vs client side navigation? wouldn't the page have same products and data fetching logic on both server and client scenario?
- What are some scenarios where you're defining different logic in these 2 functions when you define both?
- This would also mean I see different page depending on whether I navigated to this page with
<Link/> (or with <Link target="_blank"> or with <a/> 🤔 )
These concerns could be because its a bit different way to fetch data than what is defined in other frameworks so could be about familiarity as well. The behaviour just looks a little bit error prone in the first sight.
Case 2: I only define serverFetcher
Here, my page works fine on page load but does not load anything on navigation (which I understand from tech perspective that its client navigation) but from consumer-side, it seems a bit unexpected because while developing the app, I see things working as expected on page load but then while specifically testing the client navigation, it suddenly doesn't work.
This might be something that is initially not intuitive but later gets intuitive as people get more familar with framework.
But what would be cooler is if these pages have server navigation by default (might be possible with react server components although I haven't explored it much). Then navigation will also fetch these products
Other than this, everything looks super cool and super well built to me. I love how many edge cases are already covered. The treeshaking also seems to work fine which I initially thought would break seeing this API and love to see that serverFetcher gets clipped out from client-side code 🫡 ❤️
Saw this in the documentation-
My initial expectation from the names
clientFetcherandserverFetcherAPI was that serverFetcher will run on server (so I can fetch some initial data) and then clientFetcher runs post mount where I can fetch some additional data different from what I have on server.From the current behaviour, it seems like these are more of a
getInitialClientData/getInitialServerDatakind of functions which let you set the initial data and depending on navigation / load / back button click / etc, either one of them is executed.Case 1: I define
clientFetcherandserverFetcherbothIn this case I was wondering, in which scenarios would you want your page to look different if it's page load vs client side navigation? wouldn't the page have same products and data fetching logic on both server and client scenario?
<Link/>(or with<Link target="_blank">or with<a/>🤔 )These concerns could be because its a bit different way to fetch data than what is defined in other frameworks so could be about familiarity as well. The behaviour just looks a little bit error prone in the first sight.
Case 2: I only define
serverFetcherHere, my page works fine on page load but does not load anything on navigation (which I understand from tech perspective that its client navigation) but from consumer-side, it seems a bit unexpected because while developing the app, I see things working as expected on page load but then while specifically testing the client navigation, it suddenly doesn't work.
This might be something that is initially not intuitive but later gets intuitive as people get more familar with framework.
But what would be cooler is if these pages have server navigation by default (might be possible with react server components although I haven't explored it much). Then navigation will also fetch these products
Other than this, everything looks super cool and super well built to me. I love how many edge cases are already covered. The treeshaking also seems to work fine which I initially thought would break seeing this API and love to see that serverFetcher gets clipped out from client-side code 🫡 ❤️