Skip to content

fix(observability): match minified React error format in PostHog filter (SHA-2377)#220

Merged
Mlaz-code merged 1 commit into
mainfrom
fix/posthog-minified-react-#418
May 8, 2026
Merged

fix(observability): match minified React error format in PostHog filter (SHA-2377)#220
Mlaz-code merged 1 commit into
mainfrom
fix/posthog-minified-react-#418

Conversation

@Mlaz-code
Copy link
Copy Markdown
Collaborator

Summary

Completes SHA-2240 (fix(hydration): suppress React #418 errors from Nextra internals). That commit shipped suppressHydrationWarning on <body> + i18n-prop removal + IGNORED_PATTERNS for unminified error messages — but production builds minify React errors as "Minified React error #N; visit https://react.dev/errors/N...", the form PostHog actually captures.

PostHog 14d audit (2026-05-08): docs continued ingesting 125 React #418 hits across 84 distinct users after SHA-2240 — all in the minified format the existing patterns don't match.

Changes

components/PostHogProvider.tsx:

  1. Add /Minified React error #(310|418|423|425)/ so production-minified React errors are filtered alongside the un-minified dev-build versions.

  2. Generalize the prism_bash_exports special-case to /prism_\w+_exports/ plus /Export 'prism_/ + /local binding for export 'prism_/. Same root cause (PrismJS-based browser extensions injecting into the page); the audit showed prism_python_exports also firing alongside prism_bash.

Why this is safe

Pure analytics-filter change; no runtime behavior modified. SHA-2240's DOM-level suppressHydrationWarning remains the actual hydration fix — this PR only stops the residual mismatch from inflating the PostHog metric.

If a future hydration regression emerges that isn't covered by suppressHydrationWarning, it'll still surface in dev (unminified) and via the underlying user funnel — only the production noise count is muted.

Companion PR

sharpapi-site carries matching changes — https://github.com/Mlaz-code/sharpapi-site/pull/92.

Test plan

  • TypeScript clean (npm run typecheck)
  • After deploy, PostHog $exception rate drops to baseline of ~5–8/day on docs (currently ~15–36/day)
  • Manual: trigger one real error in dev to confirm filter doesn't swallow legitimate errors

Cross-references

🤖 Generated with Claude Code

…er (SHA-2377)

SHA-2240 (commit 25b7d89) shipped suppressHydrationWarning at the DOM
level + IGNORED_PATTERNS for unminified hydration error messages. But
production builds minify React errors as "Minified React error #N;
visit https://react.dev/errors/N..." — the form PostHog actually
captures from production users.

PostHog 14d audit (2026-05-08): docs continued to ingest ~125 React #418
hits across 84 distinct users after the SHA-2240 fix — all in the
minified format that the existing patterns don't match.

Two changes:

1. Add /Minified React error #(310|418|423|425)/ to IGNORED_PATTERNS so
   production-minified React errors are filtered alongside the
   un-minified dev-build versions.

2. Generalize the prism_bash_exports special-case to /prism_\w+_exports/
   plus /Export 'prism_/ + /local binding for export 'prism_/. Same root
   cause (PrismJS-based browser extensions injecting into the page); the
   audit showed prism_python_exports also firing alongside prism_bash.

Pure analytics-filter change; no runtime behavior modified. Underlying
hydration suppression from SHA-2240 still in place at the DOM layer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Mlaz-code Mlaz-code merged commit edcafbd into main May 8, 2026
@Mlaz-code Mlaz-code deleted the fix/posthog-minified-react-#418 branch May 8, 2026 21:52
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.

1 participant