Add pagination for devportal application subscriptions list#1390
Conversation
…undant per-row API detail calls
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughSubscription loading now supports offset-based retrieval, incremental API/MCP accumulation, paginated subscription tables, cached entity lookups, and separately loaded subscription dialogs. ChangesSubscription pagination flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Subscriptions
participant Subscription
participant SubscriptionsAPI
participant SubscriptionSection
Subscriptions->>Subscription: getSubscriptions(limit, offset)
Subscription->>SubscriptionsAPI: get_subscriptions(limit, offset)
SubscriptionsAPI-->>Subscription: subscription page
Subscription-->>Subscriptions: accumulated API/MCP subscriptions
Subscriptions->>SubscriptionSection: paginated rows and counts
SubscriptionSection->>Subscriptions: request page change
Subscriptions->>Subscription: load additional subscription chunks
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/Subscriptions.jsx`:
- Around line 317-318: The initial loading logic in the subscription details
component forces ten items of both subscription types, causing unnecessary
full-list traversal when a type has fewer items or is disabled. Update the
`ensureLoaded` calls in the mount path and the referenced refresh path to derive
each required count from the subscription-type accessibility flags, using zero
for disabled types; preserve independent pagination where possible by applying
backend type filters or counts.
- Around line 364-388: Update getAPIById, getMCPServerById, and
getSubscriptionPolicyByName so each cached lookup promise removes its
corresponding apiUUID or policyName entry from the relevant cache when rejected,
then rethrows the error. Preserve successful caching and ensure cleanup only
deletes the matching in-flight promise.
- Around line 444-455: The error handler in the subscription-loading flow must
not mark failed requests as fully loaded. Update the catch logic associated with
the subscription request and its callers to preserve an error state or
rethrow/reject for 5xx and network failures, while retaining the existing
404/401 handling; set completion flags only after confirmed subscription
exhaustion so retries remain possible.
In
`@portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionTableData.jsx`:
- Line 106: Update the row logic around checkIfDynamicUsagePolicy and the
related code at lines 209–232 to use the throttlingPolicy already available on
this.props.subscription instead of calling getSubscription(subscriptionId).
Remove the redundant per-row request while preserving the existing policy
evaluation behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b5539be2-7acc-4e01-bc49-d86d35a5fbe1
📒 Files selected for processing (5)
portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/index.jsxportals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionSection.jsxportals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionTableData.jsxportals/devportal/src/main/webapp/source/src/app/components/Applications/Details/Subscriptions.jsxportals/devportal/src/main/webapp/source/src/app/data/Subscription.jsx
💤 Files with no reviewable changes (1)
- portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/index.jsx
…ejected cache entries, preserve retry state on load failure, drop redundant per-row subscription fetch
095fe8b
f4894e5 to
095fe8b
Compare
|



Summary
app.subscriptionLimit, default 1000). The devportal REST endpoint enriches every returned subscription with several DB lookups, so applications with large subscription counts (e.g. 264) took over a minute to load.TablePaginationcontrol, so only the visible page's subscriptions are enriched per request. Because the subscriptions endpoint has no per-type filter, a fetched page is split client-side into the existing "Subscribed APIs" / "Subscribed MCP Servers" sections.SubscriptionTableData's two separate per-row API/MCP Server detail fetches (tier list + monetization status) into one cached fetch, cutting duplicate per-row API calls.getSubscriptionscall in the API details page.Source fix
https://github.com/wso2-support/apim-apps/pull/720
Tracking issue
wso2/api-manager#5082