Skip to content

fix(react-native): refresh displayed survey translations - #4802

Open
marandaneto wants to merge 1 commit into
mainfrom
fix/triage-js-4175-20260905
Open

fix(react-native): refresh displayed survey translations#4802
marandaneto wants to merge 1 commit into
mainfrom
fix/triage-js-4175-20260905

Conversation

@marandaneto

Copy link
Copy Markdown
Member

Problem

Displayed React Native surveys keep their old translations when the person's language changes. Later survey events also keep the old language.

Addresses #4175.

Changes

  • Refresh visible translations after person-property changes without waiting for feature flags to reload.
  • Preserve the current question, submitted answers, draft text, ratings, and choice selections. Submit selected choices using their current translated labels.
  • Keep submission and dismissal language consistent with the displayed survey, without sending duplicate shown events.
  • Add 16 regression tests and a patch changeset for posthog-react-native.

Validation

  • Reproduction-first tests failed against the original implementation (13 failures). Choice-preservation tests exposed three failures before the choice-state fix.
  • Full React Native suite: 44 files and 713 tests pass with Node 24.20.0 and pnpm 11.7.0.
  • Formatting, package lint, correctness lint, TypeScript checks, and React Native build pass.
  • Exact-HEAD autoreview completed at c17cff461a710c958c69e40947d06ec3cbedbe63. Its one finding assumed reordered choices. That finding was rejected after checking that the current RN display-order helper always returns the original choice array.
  • Tests use DOM replacements for native primitives. No device or emulator testing was performed. Choice preservation assumes translated arrays retain corresponding choice positions.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react-native-plugin
  • @posthog/react
  • @posthog/ai
  • @posthog/convex
  • @posthog/next
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/openfeature-node-provider
  • @posthog/openfeature-web-provider
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types
  • @posthog/browser-common

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

Existing patch changeset included in this branch.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Pi implemented and validated this user-directed fix using repository tools. The Pi autoreview helper reviewed the committed branch. Work was kept inside the React Native survey implementation, with no dependency or configuration changes. Local session reference: 510ebebc-a750-45a5-88ce-92821ccd3256.

The person-property notification and index-based choice state preserve in-progress answers instead of remounting the survey. Human review is required before merging.

@marandaneto marandaneto self-assigned this Sep 5, 2026
@marandaneto
marandaneto marked this pull request as ready for review September 5, 2026 17:21
@marandaneto
marandaneto requested a review from a team as a code owner September 5, 2026 17:21
@marandaneto
marandaneto requested a review from a team September 5, 2026 17:21
@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(react-native): refresh displayed sur..." | Re-trigger Greptile

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