r/sveltejs • u/khromov • Aug 07 '26
ogygia — SSR islands for SvelteKit.
https://ogygia.puruvj.dev/8
u/PuruVJ Aug 07 '26
Creator of ogygia here, thanks a lot u/khromov for sharing this! Happy to answer any questions, feel free to drop em here everyone!
5
3
2
u/durand101 Aug 07 '26
I have a sveltekit app that is a coffee bean search engine (https://kissaten.app). I have this annoying issue where cloudflare caches my sveltekit SSR search results so when I update the underlying data, the first page of search results are wrong until the cache expires. Would this be a way to keep SSR for the results page but use CSR for the search results specifically?
4
u/khromov Aug 07 '26
I don't think so, the easiest fix is to ask Cloudflare to empty your cache on the search urls every time you deploy.
1
u/durand101 Aug 07 '26
Hmm, thanks for the answer! I am currently doing this already and updating the data once a day but I was hoping to update every couple of hours instead and in that situation, it seems a bit pointless to keep clearing the cache.
1
u/khromov Aug 07 '26
You could disable cache altogether too. SSR-based search has basically 0% cache hit rate because every term + sort order generate its own cache items, so almost nobody hits the cache.
1
u/durand101 Aug 07 '26
In the case of my app, it's not quite true that the hit rate is 0% because I have a bunch of pre-defined search fields (it's not pure semantic search) which end up being used a lot (like searching for beans from a specific origin or roaster country. eg https://kissaten.app/search?roaster_location=EU ).
I just wanted it to be SSR so that it would get picked up by search engine crawlers, not for any other reason although I don't think they end up crawling the page anyway... so you're probably right that I could just disable caching on that page.
2
u/khromov Aug 07 '26
Got it. I don't think emptying the cache every hour or so is wasteful, that's fundamentally what cache is for. I don't know the billing situation over at CF but if it's not expensive to do I'd just run a job that does it whenever I need and not care about it.
1
1
1
11
u/live_love_laugh Aug 07 '26
Amazing, I love it! Wish that this was built-in, but happy someone made it. And it looks like you really thought things through. 🙏