Skip to content

refactor(web): replace manual useEffect+fetch with SWR to eliminate set-state-in-effect lint bypasses#136

Open
nocoo wants to merge 5 commits intomainfrom
fix/swr-migration
Open

refactor(web): replace manual useEffect+fetch with SWR to eliminate set-state-in-effect lint bypasses#136
nocoo wants to merge 5 commits intomainfrom
fix/swr-migration

Conversation

@nocoo
Copy link
Copy Markdown
Owner

@nocoo nocoo commented Apr 25, 2026

Closes #135

Summary

Introduces SWR as the data-fetching layer for the web dashboard, replacing all manual useEffect + fetch + setState patterns. This eliminates 33 eslint-disable react-hooks/set-state-in-effect directives across 27 files.

Changes

  1. Add SWR + shared fetcher.ts
  2. Migrate use-fetch-data.ts to SWR internally (keeps same return interface)
  3. Migrate 10 data-fetching hooks to SWR
  4. Migrate 16 page/component-level fetches to SWR
  5. Fix review findings: clear optimistic overrides after revalidation, clear sticky mutation errors

Review Notes

  • R1 Codex review found 2 issues (optimistic override stale state, sticky mutationError) — both fixed in commit 5
  • R2 review confirmed fixes; noted a theoretical race condition in org page concurrent operations (non-blocking, SWR auto-revalidation self-corrects)

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.

[🍅 tomato] refactor(web): replace manual useEffect+fetch with SWR to eliminate set-state-in-effect lint bypasses

1 participant