-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/ai pagination #3421
/ai pagination #3421
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
} | ||
}, | ||
{ mode: "replace", scroll: false } | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is initially written for the case where we render the content based on query strings on server, in RSC.
In /ai
, we simply pass the workflows to the client component, then use a react hook, and render only based on the data from that hook. So, for example,scroll: false
doesn't do anything useful.
But this component is reusable - if we proceed with the plan from #3154, then we'll use it for all pagination, and it should work reliably everywhere, e.g. on the hub's front page.
PS: it's also possible to do an invisible <AutoLoadMore />
that loads when it's scrolled into the view (that's how it worked in my side project that I took this code from), but in this case, workflows are kind of heavy and an explicit button click is probably better.
Kudos for the speed on this. On a glance it looks pretty reasonable. Eager to try it soon, will merge. |
Fixes #3420, took me about an hour to implement (I was able to copy-paste "load more" button logic from my side project).
AFAICT the mix of client-created workflows and preloaded workflows works fine, i.e. I was able to "load more" while a new workflow was running, and it continued to run. But there might be some subtle bugs that I didn't notice.