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
Issues with chat list updating and multiple chat creation #79
Comments
I believe the issue of not being able to initiate new empty chats could potentially be resolved by executing router.replace(`/chat/${id}`) in the upd: neither push nor replace were a good solution, but promising maybe? 🥲 |
onSubmit={async value => {
await append({
id,
content: value,
role: 'user'
})
if (pathname !== `/chat/${id}`) {
await router.push(`/chat/${id}`)
await router.refresh()
}
}} This works but it is too hacky I guess :( |
How did you get that |
I get pathname here: And use it there:
I don't think that solution is good enough because it leads to resetting the scroll position and other inconveniences. |
I took a look at this issue and compared the current behavior to how chatgpt implements the same flow that you showed in the video and came up with a simple solution that feels intuitive, non hacky and looks more like the way chatgpt does it:
<button
onClick={() => {
router.refresh()
router.push('/')
}}
...
I'll try to open a PR on this issue today. |
Seems just as hacky as my "solution" 🥲 |
Imo, I thought your solution was only "hacky" because it solves the problem by redirecting to the current chat's id, which is an actual good solution, but this solution doesn't allow the user to If you mean it's hacky because it refreshes and redirects, then that's because we're trying to solve a mutation problem using RSC. I don't think there's a great or "non hacky" solution in that case. If anyone else has a better solution that wouldn't require this boring refactor, I'd really love to see and learn. |
Newly initiated chats do not appear in the chats list until the page is refreshed, but you can still create the new chat.
A second new chat can't be created without a page refresh following the creation of the first one.
video.mp4
The text was updated successfully, but these errors were encountered: