Skip to content

docs: fix incorrect identifiers and broken syntax in code examples#17335

Open
emmayusufu wants to merge 1 commit into
PostHog:masterfrom
emmayusufu:docs-fix-code-example-errors
Open

docs: fix incorrect identifiers and broken syntax in code examples#17335
emmayusufu wants to merge 1 commit into
PostHog:masterfrom
emmayusufu:docs-fix-code-example-errors

Conversation

@emmayusufu
Copy link
Copy Markdown

Reading through the docs I found a set of code snippets that name methods/hooks/types that don't exist or won't compile/run as written. Each is a small, self-contained fix:

  • AI observability & logs, session replay: posthog.getSessionId() should be posthog.get_session_id(). posthog-js uses snake_case; getSessionId is not a real method, so the snippet throws at runtime.
  • AI observability, collect user feedback: the hook is useThumbSurvey, not useThumbSurveys (the rest of the page and the source export use the singular).
  • Feature flags secure key (Go): the posthog.Config composite literal was missing the trailing comma after DefaultFeatureFlagsPollingInterval (gofmt: missing ',' before newline in composite literal).
  • Install Unity (C#): Monobehavior should be MonoBehaviour.
  • Feature flags API snippet: the distinct_id string literal was missing its closing quote.
  • Feature flags JS init (react & web): missing comma after the defaults property, which breaks the object literal.
  • Nuxt: distinctId referenced a variable declared as distinctID.
  • React Native: debug: {true} should be the JSX prop debug={true}.
  • Segment: missing comma after accountType.
  • Svelte: the Node SDK link had a doubled opening parenthesis.

12 files, all one-line fixes. Happy to split if you'd prefer smaller PRs.

Several snippets across the docs name methods/hooks/types that don't exist or
won't compile/run as written:

- ai-observability and logs session-replay: posthog.getSessionId() should be
  posthog.get_session_id() (posthog-js uses snake_case; getSessionId is not a
  real method).
- ai-observability feedback: the hook is useThumbSurvey, not useThumbSurveys.
- Go flags snippet: missing trailing comma in the posthog.Config composite
  literal (gofmt: missing ',' before newline).
- Unity install: Monobehavior should be MonoBehaviour.
- feature-flags API snippet: distinct_id string literal was missing its
  closing quote.
- feature-flags JS init snippets (react/web): missing comma after the
  defaults property.
- Nuxt snippet: distinctId referenced a variable declared as distinctID.
- React Native: debug: {true} should be the JSX prop debug={true}.
- Segment: missing comma after accountType.
- Svelte: Node SDK link had a doubled opening parenthesis.
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