tinro icon indicating copy to clipboard operation
tinro copied to clipboard

How do we do prefetching?

Open saikatdas0790 opened this issue 3 years ago • 3 comments

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

saikatdas0790 avatar Oct 11 '21 09:10 saikatdas0790

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 avatar Nov 12 '21 08:11 AlexxNB

@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?

saikatdas0790 avatar Nov 12 '21 10:11 saikatdas0790

@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?

That is an interesting take on it, seems declarative enough just like Tinro.

katriellucas avatar Dec 21 '21 14:12 katriellucas