Skip to content

fix: extract shared async page hook for activity and incoming pages - #1589

Open
boluxx123 wants to merge 1 commit into
LabsCrypt:mainfrom
boluxx123:feat/issue-1085-frontend-activity-content-tsx-and-incoming
Open

boluxx123 wants to merge 1 commit into
LabsCrypt:mainfrom
boluxx123:feat/issue-1085-frontend-activity-content-tsx-and-incoming

Conversation

@boluxx123

Copy link
Copy Markdown

Overview

This PR removes the duplicated fetch/loading/error/empty-state scaffolding shared by the Activity and Incoming pages by extracting a reusable useAsyncPageData-style hook, and migrates both pages to use it. A small follow-up fix was also needed in the dashboard calendar page.

Related Issue

Changes

🔁 Shared Async Page Hook

  • [ADD] frontend/src/hooks/useAsyncPageData.ts
    • Encapsulates the common fetch/loading/error/empty-state flow used by both pages.
    • Exposes loading, error, and empty state so pages can render consistent UI without re-implementing the same branching logic.

📄 Page Migrations

  • [MODIFY] frontend/src/app/activity/activity-content.tsx

    • Replaced the page-local fetch/loading/error/empty scaffolding with useAsyncPageData.
  • [MODIFY] frontend/src/app/incoming/incoming-content.tsx

    • Replaced the page-local fetch/loading/error/empty scaffolding with useAsyncPageData.
  • [MODIFY] frontend/src/app/dashboard/calendar/page.tsx

    • Adjusted the page to align with the shared hook's loading/error handling so behavior stays consistent.

Verification Results

npm test -- frontend/src/app/activity frontend/src/app/incoming
✅ Existing tests for both pages pass
Acceptance Criteria Status
Extract a shared useAsyncPageData-style hook or shared presentational wrapper for loading/error/empty states ✅ Added frontend/src/hooks/useAsyncPageData.ts
Migrate both pages to use it ✅ activity-content.tsx and incoming-content.tsx now use the shared hook
Confirm existing tests for both pages still pass ✅ Existing tests for both pages pass

Closes #1085

@boluxx123
boluxx123 force-pushed the feat/issue-1085-frontend-activity-content-tsx-and-incoming branch from 2af03fd to f4a8698 Compare October 1, 2026 11:43
@boluxx123
boluxx123 force-pushed the feat/issue-1085-frontend-activity-content-tsx-and-incoming branch from f4a8698 to 1539caa Compare October 21, 2026 21:00

This branch has not been deployed

No deployments
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.

[Frontend] activity-content.tsx and incoming-content.tsx duplicate the same fetch/loading/error scaffolding with no shared hook

2 participants