Recommended way to deal with version skew
We have global state within our application, so when a new version is released, we don't want to perform a hard reload when navigated to a chunk that hasn't been loaded.
One thought I had was to use the router.loadRouteChunk, iterating over every route when the page has loaded. Gets us the quick initial page loaded, but then guarantees the application has all the JS it needs
Router type | TanStack Router React Docs
The Router type is used to describe a router instance. Router properties and methods An instance of the Router has the following properties and methods: .update method Type: (newOptions: RouterOptions...
4 Replies
sensitive-blue•4mo ago
are you using start or router?
we don't want to perform a hard reload when navigated to a chunk that hasn't been loaded.so which options are there really? what if the route chunk calls a backend API that was changed? it really depends what you mean by "version skew" here
fascinating-indigoOP•4mo ago
this is router, we know users will be forced to reload within 24 hours anyway, so any breaking API changes need that period of backwards compat
when I say version skew, I just mean a lack of JS chunk availability when soft navigating due to a new release
an alternative is to put every chunk on something like S3
this isn't necessary a question restricted to TSR, more code splitting in general, but it looks like TSR provides an API which could alleviate the pain
sensitive-blue•4mo ago
then you should just not use autoCodeSplitting ?
it's a tradeoff
fascinating-indigoOP•4mo ago
that was my thought too, perhaps use it for local dev, so cold starts are quicker, than just make a single bundle