fix: default kiloclaw feature flag to true when PostHog is blocked#502
Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
Open
fix: default kiloclaw feature flag to true when PostHog is blocked#502kiloconnect[bot] wants to merge 1 commit intomainfrom
kiloconnect[bot] wants to merge 1 commit intomainfrom
Conversation
Ad blockers block posthog-js in the browser, causing
useFeatureFlagEnabled('kiloclaw') to return undefined (falsy).
This hides the Claw sidebar link for users with ad blockers.
Use nullish coalescing (?? true) so that undefined defaults to true,
while an explicit false from PostHog is still respected. The server-side
flag check in the tRPC router continues to gate actual access.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
|
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
Ad blockers block
posthog-jsin the browser, souseFeatureFlagEnabled('kiloclaw')returnsundefined(falsy) — the "Claw" sidebar link disappears for users with ad blockers.Fix
Use nullish coalescing (
?? true) on the client-sideuseFeatureFlagEnabled('kiloclaw')call so that when PostHog fails to load or returnsundefined(ad blocker scenario), the flag defaults totrueinstead of being treated asfalse.truefrom PostHog → staystrue✅falsefrom PostHog → staysfalse✅undefined(PostHog blocked) → defaults totrue✅The server-side flag check in the tRPC router (
kiloclawProcedure) is unaffected — it usesposthog-nodewhich makes direct API calls from the backend and is not blocked by ad blockers. This means actual API access is still properly gated by the feature flag; this change only affects sidebar link visibility.Changes
src/app/(app)/components/PersonalAppSidebar.tsx: Added?? trueto theuseFeatureFlagEnabled('kiloclaw')callBuilt for Brendan by Kilo for Slack