Preloading Next.js thread messages and then reading them with useThreadMessages
Preloading in my Next.js page component like:
const preloadedMessages = await preloadQuery(api.chat.listMessages, {
threadId,
paginationOpts: {
numItems: 10,
cursor: null,
},
});
And then trying to figure out the syntax to pass this to useThreadMessages. Right now my error is
const messages = useThreadMessages(
preloadedMessages,
{ threadId },
{ initialNumItems: 10, stream: true },
);
Anyone have experience preloading thread messages in Next.js then passing them to useThreadMessages so they are reactive? Using the agent component and Nextjs package.
