unsloth/studio
Roland Tannous 810b2e27f3 Studio: fix React #185 update-depth loop in RAG additions
Two useEffects added in Phase 2C and Phase 4 followed the anti-pattern
of calling a state setter inside the effect and listing the setter's
output in the dep array. Both could re-fire indefinitely when the
selected slice changed shape on each render — which the chat page hit
on first load.

chat-settings-sheet.tsx (thread settings loader)
- Before: `useEffect(load, [..., threadSettings, ...])` with
  `if (!threadSettings) load()` inside. After load, the Zustand
  selector returned a freshly-constructed slice, dep changed,
  effect re-ran. If anything in between caused threadSettings to
  briefly flicker undefined (e.g. a race during initial hydration
  or a fast subsequent thread switch), the load fired again and the
  cycle repeated.
- After: ref-guarded by activeThreadId — `threadSettingsLoadedRef`
  tracks which threadId has been loaded; the effect deps shrink to
  `[ragSource.kind, activeThreadId, loadThreadSettings]`, all
  stable per-thread, removing the feedback loop.

ingestion-toast-stack.tsx (terminal-job auto-dismiss)
- Before: `useEffect(..., [jobs, dismissedJobs])` with
  `setDismissedJobs(prev => new Set(prev).add(jobId))` inside the
  scheduled setTimeout. Each setter creates a new Set reference;
  the dep change re-triggers the effect, which clears and
  reschedules timers. Under fast SSE event arrival or a strict-mode
  double-mount, the scheduler runs faster than its cleanup and
  React caps the depth.
- After: dismissedJobs is read via a ref (kept in sync at the top
  of the component); the effect only depends on `[jobs]`. A
  `scheduledJobsRef` prevents duplicate timer scheduling for the
  same job across multiple effect runs, and the setDismissedJobs
  updater no-ops when the job is already dismissed.

No behavior change for the happy path — toasts still auto-dismiss
after DISMISS_DELAY_MS; thread settings still load on first sight
of a thread.
2026-05-24 14:02:10 +04:00
..
backend Studio: RAG-as-tool composer button (Phase 4) 2026-05-24 13:41:45 +04:00
frontend Studio: fix React #185 update-depth loop in RAG additions 2026-05-24 14:02:10 +04:00
src-tauri Fix Windows workflow issues(#5694) 2026-05-22 05:32:30 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_llama_prebuilt.py ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
install_python_stack.py ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
package-lock.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
package.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 studio: regenerate desktop launcher on unsloth studio update (macOS + Linux + Windows) (#5577) 2026-05-19 05:49:10 -07:00
setup.sh Route CPU-only Linux x86_64 to ggml-org/llama.cpp prebuilts (#5302) 2026-05-05 23:22:22 -07:00
Unsloth_Studio_Colab.ipynb studio: add --local to setup.sh + overlay unsloth-zoo from git main (#5252) 2026-05-02 08:51:56 +04:00