S
SolidJS14mo ago
stiba

Infinite scrolling solid-start

I'm trying to create something like an infinite scroll. The data I'm fetching requires api-keys etc, so it has to be done server side. The initial data fetches fine, since it's being fetched on the server, but when I try to fetch more, it tries to call my api class from the browser, and the api-key are undefined (naturally). How can I make my fetchMore function only run on the server? Do I need to create an api route ?
2 Replies
lxsmnsyc
lxsmnsyc14mo ago
you probably want fetchMore as a server function, e.g. server$ (or whatever your data-fetching function is)
stiba
stibaOP13mo ago
I tried that but it gave me some weird error, I might've done something wrong. I moved it to an API route instead since it felt more correct.
Want results from more Discord servers?
Add your server