fix(activity-log): don't fetch (and toast) when paywalled#60869
Merged
Conversation
The ActivityLog component mounted activityLogLogic unconditionally, so its afterMount autofetch fired even when the org lacked the AUDIT_LOGS plan. On Cloud the backend returns 402, which kea-loaders surfaced as a "Fetch activity failed" error toast — shown alongside the PayGateMini upsell CTA that already communicates the gate. Move the activity-fetching/rendering into a child component rendered inside PayGateMini. PayGateMini only renders its children when access is granted, so the logic (and its request) no longer mounts when gated — no wasted 402, no toast. The CTA stands on its own. Affects every ActivityLog History tab, since all usages share the same gate. Generated-By: PostHog Code Task-Id: 81045d67-80ce-4720-9418-d985f43a3293
Contributor
|
Size Change: 0 B Total Size: 80.9 MB ℹ️ View Unchanged
|
Generated-By: PostHog Code Task-Id: 81045d67-80ce-4720-9418-d985f43a3293
ReeceJones
approved these changes
Jun 1, 2026
Contributor
|
Reviews (1): Last reviewed commit: "chore(activity-log): drop redundant comm..." | Re-trigger Greptile |
Contributor
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the History tab of any scene gated behind the audit-logs paywall (e.g. the Endpoints scene), an org without the required plan saw two things at once on Cloud:
PayGateMiniupsell CTA ("Activity logs — Subscribe to the Scale addon — View plans") — correct, and enough on its own.The CTA already communicates the gate, so the error toast is redundant and confusing.
Changes
ActivityLogmountedactivityLogLogicunconditionally, so itsafterMountautofetch fired regardless of the gate. On Cloud the backend returns402, which kea-loaders surfaces as the "Fetch activity failed" toast.PayGateMinionly renders itschildrenwhen access is granted. So the fix is structural: the activity-fetching/rendering now lives in a child component (ActivityLogContents) rendered insidePayGateMini. When the org is gated, that child never mounts, the logic never mounts, and the request never fires — no wasted402, no toast. When access is granted, behavior is identical to before.This affects every
ActivityLogHistory tab (all usages share the sameAUDIT_LOGSgate), not just Endpoints. The sharedactivityLogLogicis left untouched, so the other direct consumers of it are unaffected.How did you test this code?
I'm an agent. I did not perform manual testing — the local environment has no
node_modules, so I couldn't run the formatter,typescript:check, or Jest. The change is a small structural refactor of an existing component (no logic changes), relying onPayGateMini's documented behavior of only rendering children when access is granted. Reviewer should verify in a Cloud-like environment that the History tab shows only the CTA (no error toast) for a plan-less org, and renders activity normally for an entitled org.Automatic notifications
🤖 Agent context
Authored with Claude Code (Opus 4.8). The first attempt swallowed the
402insideactivityLogLogic's loader and returned empty results. On reviewer pushback ("should we even send this request?") that approach was rejected as a code smell — it fired a request known to fail and masked a real error class on shared generic logic used by 4 other consumers. The chosen approach instead prevents the request from ever mounting when gated, by relocating the fetching component insidePayGateMini's children. Reverted the logic-level change entirely; the only diff is inActivityLog.tsx.