Skip to content

fix(ui): stop Svelte 5 $effect API fetch loop and simplify Records alias column - #7

Merged
tracyhatemice merged 1 commit into
masterfrom
fix/ui-effect-loop-records-alias
Nov 29, 2026
Merged

tracyhatemice merged 1 commit into
masterfrom
fix/ui-effect-loop-records-alias

Conversation

@tracyhatemice

Copy link
Copy Markdown
Owner

Summary

Stop Continuous API Fetch Loop ($effect Reactive Tracking Bug)

  • In Svelte 5, calling an async loader directly inside $effect(() => { app.dataVersion; load(false); }) executes the synchronous prelude before the first await inside the effect's tracking context. Six views (Overview, Records, DDNS, Webhooks, Touch, Settings) read $state (!data, !records.length, !rules.length, !webhooks.length, !items.length, !savedSettings/!secrets.length/!sessions.length) before await, then assigned freshly fetched objects/arrays to those same $state variables, re-triggering $effect continuously in an infinite loop.
  • Wrapped async loader invocations in untrack(() => ...) across all 6 affected views and defensively hardened AccessLog, AuditLog, RecordDrawer, and App.
  • Views now issue zero idle background requests — fetching only on mount, after mutations (dataVersion), on filter/page/range changes, or via manual Refresh.

Clean Up Alias Display on Records Page

  • Removed the → member1, member2 subtitle under the IAM Name column in Records.svelte; alias members remain accessible with clickable links in RecordDrawer and filterable via member:.

Regression Tests

  • Added ui/src/lib/viewEffects.test.js using Svelte 5's compiler/parser AST to verify all data-loading $effect blocks wrap async loader calls in untrack(), and that the Records table row header omits alias members while RecordDrawer keeps them.

Verification

  • pnpm --dir ui run check: 27/27 tests pass + Vite dev build clean (0 Svelte compiler warnings across all 10 edited components).
  • pnpm --dir ui run build: production bundle built cleanly.
  • golangci-lint run: 0 issues.
  • go test -count=1 -race -cover ./...: all 6 packages pass.
  • CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o who .: clean static binary build.

@tracyhatemice
tracyhatemice merged commit cc863ec into master Nov 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant