Skip to content

fix: guard advance-analytics API calls on Community Edition#9246

Open
okxint wants to merge 1 commit into
makeplane:previewfrom
okxint:fix/advance-analytics-community-edition
Open

fix: guard advance-analytics API calls on Community Edition#9246
okxint wants to merge 1 commit into
makeplane:previewfrom
okxint:fix/advance-analytics-community-edition

Conversation

@okxint

@okxint okxint commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

On Community Edition, clicking the Analytics tab triggers /advance-analytics, /advance-analytics-charts, and /advance-analytics-stats API calls that don't exist on CE, resulting in 500s and a broken UI.

Root cause: The analytics page mounts TotalInsights, ProjectInsights, CreatedVsResolved, PriorityChart, and WorkItemsInsightTable unconditionally — all of which fire advance-analytics requests on mount. The instance config already exposes is_self_managed: true on CE, but the analytics page wasn't checking it.

Fix: In apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx, check instanceConfig.is_self_managed via useInstance(). When true, render an informational empty state instead of the tabs. No API calls fire. Also adds the not_available_ce i18n key to all 19 supported locales.

Closes #9237

Summary by CodeRabbit

  • New Features
    • Workspace analytics now displays a Community Edition restriction notice, guiding users to upgrade for access
    • Restriction messaging is available across 17 supported languages

On CE (is_self_managed: true), the analytics page was mounting
components that fired requests to /advance-analytics,
/advance-analytics-charts, and /advance-analytics-stats — endpoints
that only exist on Pro/Cloud. This caused 500 errors and a broken UI.

Check is_self_managed from instance config in the analytics page and
render an informational empty state instead of the tabs, preventing
any API calls from firing on CE.

Adds the not_available_ce i18n key to all 19 supported locales.

Fixes makeplane#9237
@coderabbitai

coderabbitai Bot commented Jun 17, 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 94662665-43c3-4087-b83b-d4ac3955ea77

📥 Commits

Reviewing files that changed from the base of the PR and between 53a323d and 9cbff68.

📒 Files selected for processing (20)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx
  • packages/i18n/src/locales/cs/workspace.json
  • packages/i18n/src/locales/de/workspace.json
  • packages/i18n/src/locales/en/workspace.json
  • packages/i18n/src/locales/es/workspace.json
  • packages/i18n/src/locales/fr/workspace.json
  • packages/i18n/src/locales/id/workspace.json
  • packages/i18n/src/locales/it/workspace.json
  • packages/i18n/src/locales/ja/workspace.json
  • packages/i18n/src/locales/ko/workspace.json
  • packages/i18n/src/locales/pl/workspace.json
  • packages/i18n/src/locales/pt-BR/workspace.json
  • packages/i18n/src/locales/ro/workspace.json
  • packages/i18n/src/locales/ru/workspace.json
  • packages/i18n/src/locales/sk/workspace.json
  • packages/i18n/src/locales/tr-TR/workspace.json
  • packages/i18n/src/locales/ua/workspace.json
  • packages/i18n/src/locales/vi-VN/workspace.json
  • packages/i18n/src/locales/zh-CN/workspace.json
  • packages/i18n/src/locales/zh-TW/workspace.json

📝 Walkthrough

Walkthrough

The analytics page now reads useInstance() to derive an isSelfManaged flag. When true, it renders a localized "not available on Community Edition" empty state instead of the existing analytics tabs and API calls. Matching workspace_analytics.not_available_ce title/description keys are added to all 19 supported locale files.

Changes

Analytics Community Edition Gate

Layer / File(s) Summary
Analytics page CE gating logic
apps/web/app/(all)/[workspaceSlug]/(projects)/analytics/[tabId]/page.tsx
Imports useInstance, derives isSelfManaged from instanceConfig, and wraps the existing analytics render branch with a conditional that shows a centered not-available message for self-managed instances instead of calling unsupported advance-analytics endpoints.
not_available_ce i18n strings across 19 locales
packages/i18n/src/locales/*/workspace.json
Adds workspace_analytics.not_available_ce.title and workspace_analytics.not_available_ce.description to all locale files (en, cs, de, es, fr, id, it, ja, ko, pl, pt-BR, ro, ru, sk, tr-TR, ua, vi-VN, zh-CN, zh-TW) to supply the text rendered by the new empty state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A bunny hops past the analytics gate,
"Community Edition? No charts, sorry — wait!"
isSelfManaged flips the sign to true,
An empty state renders in every tongue too.
No more 500s crashing the view,
The warren is patched and the pipeline runs through! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description provides detailed context about the root cause and fix, but lacks structured completion of the template's Type of Change, Screenshots, Test Scenarios, and References sections. Complete the description template by selecting Type of Change checkbox, adding Test Scenarios, and confirming References (issue #9237).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: guarding advance-analytics API calls on Community Edition to prevent 500 errors.
Linked Issues check ✅ Passed The PR fully addresses issue #9237 by implementing the fix to guard advance-analytics API calls on CE and prevent 500 errors with an informational empty state.
Out of Scope Changes check ✅ Passed All changes are directly in scope: guarding API calls in the analytics page component and adding corresponding i18n keys across 19 locales for the CE unavailability message.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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 and usage tips.

@yonisenriquecausil-design

Copy link
Copy Markdown

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.

[bug]: Frontend calls /advance-analytics endpoints on Community Edition resulting in 500 Internal Server Error

2 participants