Skip to content

Conversation

@martinjagodic
Copy link

This PR adds a footer status bar that displays real-time GitHub API rate limit information when using the GitHub backend.

The status bar shows:

  • CMS version
  • Current backend name
  • GitHub API requests used vs. total available
  • Percentage of quota consumed
  • Time when the rate limit resets

Motivation

Users need visibility into their GitHub API rate limit consumption, especially during heavy editorial workflows that make frequent API calls. Without this information, users can unknowingly hit rate limits and have operations fail without clear feedback.

Example output:

decap-cms-app 3.9.0 | Github GraphQL backend, 529 / 5000 (10.6%) requests used, ratelimit reset at 12:00:53

Visual:

Screenshot 2025-12-11 at 15 09 34

Technical Details

Rate Limit Header Extraction

  • REST API: Headers extracted from HTTP responses in API.ts
  • GraphQL API: Headers captured via custom fetch wrapper in getApolloClient()
  • Supported headers: x-ratelimit-used, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset, x-ratelimit-resource

State Management

  • New Redux action SET_RATE_LIMIT_INFO dispatches rate limit data
  • State stored in status reducer under rateLimitInfo
  • GitHub backend passes dispatch callback to API constructors

Performance Optimization

  • Throttled dispatch using lodash.throttle (1000ms window, leading + trailing)
  • Prevents flooding Redux with updates from rapid API calls
  • Maintains responsive feedback while limiting re-renders

Localization

  • Translations added for English and Slovenian
  • Strings: app.statusBar.backend, app.statusBar.requestsUsed, app.statusBar.resetAt

Testing

  • Unit tests pass

Future Enhancements

  • Support for rate limit information from other backends (GitLab, Gitea, etc.)
  • Config (or user?) setting to turn it on/off
  • Warning indicators when approaching rate limit threshold
  • Historical rate limit tracking/charting

@netlify
Copy link

netlify bot commented Dec 11, 2025

Deploy Preview for pm-decap-cms ready!

Name Link
🔨 Latest commit 60f9573
🔍 Latest deploy log https://app.netlify.com/projects/pm-decap-cms/deploys/693ad19186c52e00081324d7
😎 Deploy Preview https://deploy-preview-6--pm-decap-cms.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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