mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
docs: clarify custom navigation
This commit is contained in:
parent
b1b446f55a
commit
a9f9f8b549
@ -400,9 +400,12 @@ ${value.content}
|
|||||||
|
|
||||||
function navigateChat(nextId: string) {
|
function navigateChat(nextId: string) {
|
||||||
/**
|
/**
|
||||||
* FIXME: Using the intended navigate function causes a rerender for <Chat /> that breaks the app.
|
* We intentionally avoid using Remix's `navigate` helper here.
|
||||||
*
|
*
|
||||||
* `navigate(`/chat/${nextId}`, { replace: true });`
|
* Calling `navigate(`/chat/${nextId}`, { replace: true })` triggers a full
|
||||||
|
* route transition. That unmounts `<Chat />` which loses the in-memory chat
|
||||||
|
* state and results in a broken UI. Updating the history directly keeps the
|
||||||
|
* component mounted while still reflecting the new chat ID in the URL.
|
||||||
*/
|
*/
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.pathname = `/chat/${nextId}`;
|
url.pathname = `/chat/${nextId}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user