Skip to content

fix(sdk): use searchOrganizationInvoices and value-based debounce#1748

Open
rohanchkrabrty wants to merge 1 commit into
mainfrom
fix-sdk-billing-rpc
Open

fix(sdk): use searchOrganizationInvoices and value-based debounce#1748
rohanchkrabrty wants to merge 1 commit into
mainfrom
fix-sdk-billing-rpc

Conversation

@rohanchkrabrty

Copy link
Copy Markdown
Contributor

Summary

  • Replace the deprecated listInvoices RPC with searchOrganizationInvoices, backed by a new shared useOrganizationInvoices infinite-query hook.
  • Collocate the past-due open-invoices query inside PaymentIssue (gated on hasAccess) and slim billing-view down to layout orchestration.
  • Add a shared useDebouncedValue hook (@raystack/frontier/hooks) that debounces the derived value in an effect, replacing the unsafe render-phase usehooks-ts debounce and Apsara's useDebouncedState.
  • Debounce the computed request query in the tokens, invoices, PAT, members, projects, and APIs DataTable views so filters/search apply reliably without lagging the table UI.
  • Revert the redundant search-debounce plumbing in the org details context now that debouncing lives on the computed query.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Jul 10, 2026 11:17am

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b88c64b3-e1e0-494e-89e1-80f7bdac6584

📥 Commits

Reviewing files that changed from the base of the PR and between cd6b070 and 44ec283.

📒 Files selected for processing (13)
  • web/sdk/admin/views/organizations/details/apis/index.tsx
  • web/sdk/admin/views/organizations/details/invoices/index.tsx
  • web/sdk/admin/views/organizations/details/members/index.tsx
  • web/sdk/admin/views/organizations/details/pat/index.tsx
  • web/sdk/admin/views/organizations/details/projects/index.tsx
  • web/sdk/admin/views/organizations/details/tokens/index.tsx
  • web/sdk/client/hooks/useOrganizationInvoices.ts
  • web/sdk/client/views/billing/billing-view.tsx
  • web/sdk/client/views/billing/components/invoices.tsx
  • web/sdk/client/views/billing/components/payment-issue.tsx
  • web/sdk/client/views/tokens/tokens-view.tsx
  • web/sdk/hooks/index.ts
  • web/sdk/hooks/useDebouncedValue.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added centralized invoice loading for billing views, including pagination and invoice status handling.
    • Payment issue notifications now display eligible open invoices automatically.
  • Improvements
    • Improved search responsiveness across organization details, billing invoices, and token views with consistent delayed query updates.
    • Billing access handling is now more reliable while invoice data loads.
  • Bug Fixes
    • Improved invoice error reporting with clearer notifications when invoice retrieval fails.

Walkthrough

The SDK adds a shared debounce hook and organization-invoice query hook. Billing invoice and payment-issue views now use centralized invoice fetching, pagination, filtering, loading, and error handling. Administrative organization views and token search switch to the shared debounce implementation.

Changes

Billing SDK data flow

Layer / File(s) Summary
Shared debounce hook and consumers
web/sdk/hooks/*, web/sdk/admin/views/organizations/details/*, web/sdk/client/views/tokens/tokens-view.tsx
Adds useDebouncedValue and updates organization and token query consumers to use its direct value return.
Organization invoice query hook
web/sdk/client/hooks/useOrganizationInvoices.ts
Adds shared paginated invoice fetching with flattened invoices, group counts, query state, and pagination controls.
Billing invoice table integration
web/sdk/client/views/billing/components/invoices.tsx
Replaces local invoice querying and count derivation with the shared hook and debounced table queries.
Payment issue and billing integration
web/sdk/client/views/billing/components/payment-issue.tsx, web/sdk/client/views/billing/billing-view.tsx
Moves payment-issue invoice retrieval into the shared hook, adds server-side open-invoice filtering and local error handling, and passes billing access instead of invoice data.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: rsbh, paanSinghCoder, rohilsurana

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29088987012

Coverage remained the same at 44.876%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37644
Covered Lines: 16893
Line Coverage: 44.88%
Coverage Strength: 12.54 hits per line

💛 - Coveralls

@rohanchkrabrty rohanchkrabrty requested a review from rsbh July 10, 2026 11:52
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