Skip to content

fix: resolve api route mapping, response type validation, and signatu…#325

Merged
AlAfiz merged 1 commit into
BETAIL-BOYS:mainfrom
Alhaji-naira:fix/cleanup-and-stability-fixes
Jun 16, 2026
Merged

fix: resolve api route mapping, response type validation, and signatu…#325
AlAfiz merged 1 commit into
BETAIL-BOYS:mainfrom
Alhaji-naira:fix/cleanup-and-stability-fixes

Conversation

@Alhaji-naira

Copy link
Copy Markdown
Contributor

PR Description: Monorepo Cleanup, API Route Fixes, and Layout Stabilization

Overview

This PR addresses code debt, removes unused files accumulated during the hackathon phase, resolves layout/provider crashes, and fixes runtime API and state rendering loops to make the application fully stable in both development and production builds.

Key Changes

1. Codebase Cleanup & Technical Debt Reduction

  • Unused Code Removal: Safely deleted redundant hooks (useDebounce, useWalletConnection, useSorobanEvents), test files, mock scripts, and unused components (e.g., SwapInterface, ExpertModeModal, Sidebar).
  • Dependency & Import Fixes:
    • Corrected import pathways and standardized default imports for Slider and Checkbox components.
    • Type-safe cast Sentry configuration and TanStack Query parameters to adapt to newer library versions.

2. Layout & Context Stabilization

  • Root Layout Restructuring: Nested layout elements inside missing global providers (SettingsProvider, QueryProvider, BackendHealthProvider, and NetworkGuard) in src/app/layout.tsx to prevent context bails downstream.
  • Render Loop Elimination: Refactored useSigningActions selector hook in src/stores/signatureStore.ts to query slice variables individually, preventing React hydration loops and resolving the Maximum update depth exceeded runtime overlay error.

3. API Path Resolution & Paginated Validation

  • Path Correction: Changed target endpoint from /invoices to /api/invoices in src/lib/api.ts to properly call the Next.js API route.
  • Interface & Validator Matching: Redefined InvoicesResponse type definition and the isInvoicesResponse validator function in types/api.ts to accommodate the paginated API response payload shape ({ data: InvoiceSummary[], pagination: ... }).
  • State Update Adaptation: Modified the client page fetch cycle in src/app/page.tsx to call setInvoices(res.data.data).

Verification & Testing

  • Type Safety: Verified via tsc --noEmit returning zero compilation errors.
  • Production Build: Executed npm run build successfully (Exit code: 0).
  • Manual Verification: Navigated the application locally on http://localhost:3000/; verified the Verified Asset Pipeline dashboard table retrieves, validates, and renders the mock invoice rows cleanly.

closes #271

…re store render loop

- Corrected invoice API endpoint route from /invoices to /api/invoices in src/lib/api.ts
- Updated InvoicesResponse and isInvoicesResponse validator in types/api.ts to support the paginated payload structure
- Updated page.tsx to bind res.data.data array instead of the raw pagination wrapper
- Refactored useSigningActions selector in src/stores/signatureStore.ts to use individual selectors to prevent render loops
- Stabilized root layout.tsx context provider ordering and child element tree
- Cleaned up unused variables and solved TanStack Query / Framer Motion type errors
@AlAfiz AlAfiz merged commit 3b8473f into BETAIL-BOYS:main Jun 16, 2026
1 check passed

@AlAfiz AlAfiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice and Great work done. A proper clean up

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.

Do a codebase sweep to clean up unused variables, dead code, and obsolete comments

2 participants