unsloth/studio/frontend
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
..
public Polish/cloud to providers (#5450) 2026-05-15 19:29:21 +04:00
src Studio: fix React #185 update-depth loop in RAG additions 2026-05-24 14:02:10 +04:00
.gitignore perf(studio): upgrade to Vite 8 + auto-install bun for faster frontend builds (#4522) 2026-03-25 04:27:41 -07:00
.gitkeep add studio root folder 2026-02-02 09:14:35 +00:00
.npmrc security: NOT affected by Mini Shai-Hulud (May-12 wave) -- forward-looking hardening only (#5397) 2026-05-13 04:58:12 -07:00
biome.json feat: add seed dataset support with configuration, preview, and builder utilities 2026-02-14 18:44:38 +01:00
components.json add studio root folder 2026-02-02 09:14:35 +00:00
data-designer.openapi (1).yaml save and import, and fixes 2026-02-04 14:32:49 +01:00
eslint.config.js Final cleanup 2026-03-12 18:28:04 +00:00
index.html Final cleanup 2026-03-12 18:28:04 +00:00
package-lock.json Add OpenDocument chat attachments (#5510) 2026-05-18 03:41:24 -07:00
package.json Add OpenDocument chat attachments (#5510) 2026-05-18 03:41:24 -07:00
tsconfig.app.json Relax frontend unused local check (#4388) 2026-03-17 16:04:11 -07:00
tsconfig.json cleanup 2026-02-04 13:28:39 +01:00
tsconfig.node.json cleanup 2026-02-04 13:28:39 +01:00
vite.config.ts Fix Install commands for Windows + 1 line installs (#4447) 2026-03-19 02:09:09 -07:00