unsloth/studio/frontend/src
Lee Jackson 8c89b84bb6
Studio: Fix empty chat threads on navigation and stabilize new chat flow (#4872)
* fix(chat): prevent implicit empty thread creation and stabilize new-chat flow

* fix(chat): harden compare thread sync and simplify sidebar thread query

* fix(chat): harden new-thread state sync and isolate compare active thread updates

* fix(chat): stabilize new-thread state sync and prevent compare/session bleed

* Fix thread restoration, handleNewThread guard, sidebar filter, and delete flow

- Remove __LOCALID_ filter from getInitialSingleChatView: in this
  Dexie-backed adapter, AUI's __LOCALID_ prefixed IDs ARE the real
  persistent thread IDs stored by initialize(). Filtering them out
  breaks thread restoration on navigation.

- Simplify handleNewThread to synchronous: the async Dexie message
  check is redundant (persistence is already deferred to first append)
  and strands users on legacy empty threads. Use a simple guard that
  checks the store's activeThreadId to detect unsent drafts.

- Add message-count filter to sidebar: filter threads to only show
  those with at least one message, hiding legacy empty threads.

- Add store-based sidebar highlighting fallback: use activeThreadId
  from the store when view.threadId is not set (nonce-backed chats).

- Fix handleDelete to call onNewThread() instead of onSelect(), and
  clear activeThreadId, so the runtime properly resets after deleting
  the active thread.

* Fix handleDelete nonce path and restore __LOCALID_ filter

handleDelete was calling onNewThread() after clearing activeThreadId,
but the handleNewThread guard sees !view.threadId && !activeThreadId
and returns early, leaving the UI stuck on the deleted thread.
Fix by directly calling onSelect with a new nonce instead.

Restore __LOCALID_ filter in getInitialSingleChatView to prevent
restoring unpersisted AUI local thread IDs on navigation. Without
this filter, navigating away from /chat before sending a message
would restore a non-existent thread that Dexie cannot fetch.

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
2026-04-06 09:32:54 -07:00
..
app turning data recipes on for mac (#4454) 2026-03-19 11:11:27 +04:00
assets Final cleanup 2026-03-12 18:28:04 +00:00
components feat(studio): differentiate web search and URL fetch in chat tool UI (#4802) 2026-04-03 05:03:27 -07:00
config UI Changes (#4782) 2026-04-02 08:05:55 -07:00
features Studio: Fix empty chat threads on navigation and stabilize new chat flow (#4872) 2026-04-06 09:32:54 -07:00
hooks feat(studio): strip org prefix in model search to surface unsloth variants (#4749) 2026-04-01 04:37:28 -07:00
lib fix: throttle and cache HuggingFace modelInfo API calls (#4696) 2026-03-31 02:21:17 -07:00
shared Update license headers 2026-03-12 17:23:10 +00:00
stores Update license headers 2026-03-12 17:23:10 +00:00
types Update license headers 2026-03-12 17:23:10 +00:00
utils Update license headers 2026-03-12 17:23:10 +00:00
index.css studio: fix chat font changes leaking outside chat page (#4775) 2026-04-02 05:04:23 -07:00
main.tsx chat only with gguf for mac devices (#4300) 2026-03-15 23:20:48 +04:00
speech-recognition.d.ts Update license headers 2026-03-12 17:23:10 +00:00