Skip to content

refactor(frontend): Extract useAsyncPageData hook for shared page state scaffolding (#1085) - #1142

Open
abdulqoyumadegoke wants to merge 1 commit into
LabsCrypt:mainfrom
abdulqoyumadegoke:refactor/1085-shared-async-page-data-hook
Open

refactor(frontend): Extract useAsyncPageData hook for shared page state scaffolding (#1085)#1142
abdulqoyumadegoke wants to merge 1 commit into
LabsCrypt:mainfrom
abdulqoyumadegoke:refactor/1085-shared-async-page-data-hook

Conversation

@abdulqoyumadegoke

Copy link
Copy Markdown

Closes #1085

Overview

Resolves #1085 by extracting a shared useAsyncPageData hook in frontend/src/hooks/useAsyncPageData.ts and refactoring activity-content.tsx and incoming-content.tsx to use it for unified loading, error, hydration, wallet connection, and empty state scaffolding.

Key Changes

  • frontend/src/hooks/useAsyncPageData.ts: Created a reusable custom hook encapsulating useWallet hydration and connection status, query loading states, error message normalization, and empty list detection.
  • useAsyncPageData.test.ts: Added unit tests covering hydration, wallet status, loading, error string extraction, and empty data scenarios.
  • activity-content.tsx & incoming-content.tsx: Migrated page components to consume useAsyncPageData state properties.

Verification

  • Verified unit tests for useAsyncPageData and existing page components.

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

1 participant