Repository navigation
[CI] (cc5471b) react-router/saas-template - #4791
Closed
wizard-ci-bot[bot] wants to merge 2 commits into
Closed
wizard-ci-bot[bot] wants to merge 2 commits into
wizard-ci-bot[bot] wants to merge 2 commits into
Conversation
Author
PR Evaluation ReportSummaryThis PR adds PostHog integration to a React Router v7 framework-mode SaaS template. It installs
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Missing ssr.noExternal for posthog-js and @posthog/react in vite.config.ts — may cause SSR build/runtime errors per React Router v7 framework mode docs |
|
| Preserves existing env vars & configs | Yes | Existing configs preserved; PostHog additions are additive |
| No syntax or type errors | Yes | All changed files have valid TypeScript/TSX syntax |
| Correct imports/exports | Yes | posthog-js and @posthog/react imports are correct |
| Minimal, focused changes | Yes | All changes are PostHog-related |
| Pre-existing issues | None |
Issues
- Missing
ssr.noExternalin vite.config.ts: The React Router v7 framework mode docs explicitly state thatposthog-jsand@posthog/reactmust be added tossr: { noExternal: [...] }invite.config.tsto avoid SSR errors. Ten+ component files import@posthog/reacthooks that are processed during SSR. Addssr: { noExternal: ['posthog-js', '@posthog/react'] }to the Vite config. [CRITICAL] posthog.logger.info()misuse: Innav-user.tsxandpastes.tsx,posthog?.logger.info(...)is used as if it were an event capture method. This is actually PostHog's internal SDK debug logger — it only outputs to the browser console when debug mode is enabled and sends no data to PostHog. Remove these calls or replace withposthog.capture()if the intent was to send events. [LOW]
Other completed criteria
- Environment variables documented in
.env.examplewithVITE_PUBLIC_POSTHOG_PROJECT_TOKENandVITE_PUBLIC_POSTHOG_HOST - CSP headers updated in
entry.server.tsxforconnect-src,script-src, andworker-src .gitignoreupdated to exclude.env- Env schema in
env.server.tsupdated with optional PostHog vars andgetEnv()exposes them to the client - Build config (package.json) includes correct dependency versions
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js ^1.441.2 and @posthog/react ^1.11.3 added to package.json |
| PostHog client initialized | Yes | posthog.init() in entry.client.tsx with api_host, defaults: "2026-08-30", and logs config; wrapped with PostHogProvider client={posthog} |
| capture() | Yes | 12+ meaningful capture calls across org creation, settings, invitations, onboarding, and pastes |
| identify() | Yes | posthog.identify(user.id, { email }) in authenticated layout via loader + useEffect with dedup check; user.id is a stable auth system ID |
| Error tracking | Yes | PostHogErrorBoundary wraps the entire app inside PostHogProvider |
| Reverse proxy | No | Not configured — client-side events will be blocked by ad blockers |
Issues
- No reverse proxy: For a full-stack React Router app, the docs recommend setting up a reverse proxy to prevent ad blockers from intercepting PostHog events. This can be done via Next.js-style rewrites, Vercel rewrites, Cloudflare, or PostHog's managed proxy service. [MEDIUM]
- Redundant env checks on every capture: Every capture call is wrapped in
if (window.ENV.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN && window.ENV.VITE_PUBLIC_POSTHOG_HOST). This is unnecessary sinceposthog?.capture()safely no-ops when PostHog isn't initialized (theinitializePostHog()function already guards against missing env vars). This adds boilerplate to every event site. [LOW]
Other completed criteria
- API key loaded from
window.ENV.VITE_PUBLIC_POSTHOG_PROJECT_TOKEN(not hardcoded) - Host configured from
window.ENV.VITE_PUBLIC_POSTHOG_HOST posthog.reset()called on logout innav-user.tsx- Identify uses stable
user.idfrom auth system, email passed as person property (correct) - Dedup check:
posthog.get_distinct_id() !== distinctIdprevents redundant identify calls
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
entry.client.tsx |
PostHogErrorBoundary |
Captures uncaught React exceptions via error boundary |
_authenticated-routes-layout.tsx |
identify() |
Identifies authenticated users with user.id and email |
nav-user.tsx |
reset() |
Resets PostHog identity on logout |
create-organization-form-card.tsx |
organization_creation_submitted |
Org creation form submit |
danger-zone.tsx (org) |
organization_deletion_submitted |
Org deletion confirmation |
general-organization-settings.tsx |
organization_settings_updated |
Org settings save |
invite-by-email-card.tsx |
team_invitation_submitted |
Email invite sent |
invite-link-card.tsx |
invite_link_copied, invite_link_generated, invite_link_deactivated |
Invite link lifecycle |
account-settings.tsx |
account_settings_updated |
User account settings save |
danger-zone.tsx (user) |
account_deletion_submitted |
Account deletion confirmation |
organization.tsx (onboarding) |
onboarding_organization_submitted |
Onboarding org step |
user-account.tsx (onboarding) |
onboarding_user_account_submitted |
Onboarding user step |
pastes.tsx |
paste_creation_submitted |
Paste creation form submit |
Issues
- No event properties on any capture call: All 12+ capture calls are bare (
posthog.capture('event_name')) with zero properties. This makes it impossible to break down events by org, user role, plan, or any other dimension. For example,organization_deletion_submittedshould includeorganization_id;paste_creation_submittedshould includeorganization_slug;invite_link_generatedshould include the invite method. [MEDIUM]
Other completed criteria
- Events represent real user actions mapping to product flows (onboarding → org creation → settings → invite → usage)
- Events could build a funnel: onboarding_user_account_submitted → onboarding_organization_submitted → paste_creation_submitted
- Event names are descriptive, consistent snake_case
- No PII in capture properties; email correctly placed in identify person properties only
Reviewed by wizard workbench PR evaluator
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.
Automated wizard CI run
Source: scheduled
Trigger ID:
cc5471bApp:
react-router/saas-templateApp directory:
apps/react-router/saas-templateWorkbench branch:
wizard-ci-cc5471b-react-router-saas-templateWizard branch:
mainContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-10-28T17:03:30.460Z
Duration: 484.6s
YARA Scanner