Skip to content

Erratic behavior of useChat - Could SWR be the issue? #1656

Closed
@martinjo

Description

@martinjo

Description

I've been having some trouble getting consistent behavior from this library when using useChat in my Svelte application. Updating, reloading, and deleting messages have been erratic, and I'm not sure what I'm doing wrong.

After trying everything I could think of in my application, I decided to replace SWR in useChat with a regular Svelte store to keep track of the chats. This simple change made the library behave exactly as I expected. Now, I can call useChat at any point in the application, not just during component initialization as it seemed to require before. Since making this change, I haven't experienced any issues.

What is the advantage of using SWR for Svelte users?

Also, I tried to install the library from a Github fork, but I encountered an error saying that the name is missing. Is it possible to install directly from a Github fork? How can I do that? To test my changes I had to incorporate the source into my project and naturally this will be hard to maintain...

Code example

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/uibugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions