tinro
tinro copied to clipboard
How do we do prefetching?
Like hovering on an anchor tag sends the corresponding request and we save a couple of hundred milliseconds in delay that leads to a snappier end user experience.
Coming from SvelteKit, this is the corresponding documentation https://kit.svelte.dev/docs#anchor-options-sveltekit-prefetch
There is no way to prefetch right now. I have no idea how to implement this in routers type like tinro where routes structure doesn't known by router.
@AlexxNB Thinking out aloud, couldn't Tinro support a <script context="module></script>
block that runs code on the client side before the route component gets loaded. And prefetching/preloading logic could be coded there by the dev. And we annotate the anchor tags with a tinro:prefetch
to indicate that this route needs to prefetch content?
@AlexxNB Thinking out aloud, couldn't Tinro support a
<script context="module></script>
block that runs code on the client side before the route component gets loaded. And prefetching/preloading logic could be coded there by the dev. And we annotate the anchor tags with atinro:prefetch
to indicate that this route needs to prefetch content?
That is an interesting take on it, seems declarative enough just like Tinro.