Skip to content

refactor: split large ResearchPage and AddActivityDialog - #143

Merged
NoviUIKI merged 1 commit into
feat/artifacts-deletefrom
feat/component-splits
Aug 19, 2026
Merged

NoviUIKI merged 1 commit into
feat/artifacts-deletefrom
feat/component-splits

Conversation

@BerryUIKI

@BerryUIKI BerryUIKI commented Aug 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Split two large components (task #6).

Changes

  • ResearchPage (695 lines): extracted ResearchProjectsSection / ResearchDocumentsSection / ResearchNotesSection into pages/research/components; the page keeps state, queries, mutations, and URL-context logic
  • AddActivityDialog (528 lines): extracted a stateless presentational ActivityFormFields (values + change callbacks); the dialog keeps validation, submit logic, and focus trap

Base is feat/artifacts-delete (stacked PR); merge after #142.

@BerryUIKI
BerryUIKI force-pushed the feat/component-splits branch from b84c5c0 to 9831d5f Compare August 19, 2026 02:35
@BerryUIKI
BerryUIKI force-pushed the feat/component-splits branch from 9831d5f to 414106a Compare August 19, 2026 03:36

@NoviUIKI NoviUIKI left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary — PR #143

Verdict: ✅ Approve

Well-executed decomposition. I verified the extraction is behavior-preserving: typecheck passes and the 38 tests covering this code all pass.

Critical

  • None.

Important

  • None.

Suggestions (non-blocking)

  1. The researchOperationError banner is permanent once triggered (ResearchPage.tsx). It ORs five mutations' isError states, and React Query only resets isError for the mutation that is re-run — so after one failed delete, the banner stays on screen even after later operations succeed, and there's no dismiss. Consider tracking the last failed operation (or adding a dismiss) so the banner reflects current state.
  2. ActivityFormFields takes ~20 value+callback props. Idiomatic controlled-component extraction, but if the form grows, a useReducer (or form library) in the container would cut the prop surface substantially.
  3. Minor: the STATUSES label nested-ternary in ActivityFormFields.tsx is dense — a Record<ActivityStatus, MessageKey> lookup (mirroring ACTIVITY_TYPES) would read better.
  4. Minor: the .mutate() error banner is generic (unexpectedError); a per-operation message ("Failed to delete project", etc.) would be more actionable.

Strengths

  • Clean split: ResearchPage and AddActivityDialog keep all state, queries, mutations, and URL context; the new sections are presentational with value+callback props and fully typed interfaces (MessageKey, ReportType, ActivityType, …).
  • Fixes a latent bug: the asset-select placeholder in AddActivityDialog previously rendered t("cancel") (i.e. "-- Cancel --"); it now uses the proper t("selectAsset") key.
  • Surfaces previously-silent errors: the archive/complete/delete .mutate() calls (which swallow failures into isError) now render a role="alert" banner, matching the error-surfacing direction of PR #141.
  • Removes the remaining (t(...) as any) casts (including the one in AddActivityDialog noted in the PR #140 review).
  • New files get trailing newlines; git diff --check is clean.

Verification

  • tsc --noEmit (apps/desktop): passes.
  • ResearchPage.test.tsx (13), dialogs.test.tsx (20), ActivityList.test.tsx (5): 38/38 pass.
  • git diff --check: clean.

- ResearchPage (695 lines): extract ResearchProjectsSection,
  ResearchDocumentsSection, ResearchNotesSection into
  pages/research/components; page keeps state/queries/mutations/URL context
- AddActivityDialog (528 lines): extract presentational ActivityFormFields
  (value + callback props); dialog keeps state, validation, submit, focus trap
@NoviUIKI
NoviUIKI force-pushed the feat/component-splits branch from 414106a to 37c65f9 Compare August 19, 2026 05:17
@NoviUIKI
NoviUIKI merged commit 4ed6536 into dev Aug 19, 2026
6 of 8 checks passed
@NoviUIKI
NoviUIKI deleted the feat/component-splits branch August 19, 2026 05:18
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.

2 participants