Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(app): stop in-page translation crashing whole scenes (#96866)

Rafael Audibert00a08ee0bdd4
diff --git a/frontend/src/AGENTS.md b/frontend/src/AGENTS.md
index 491c6b1935f5..4edda480fdd0 100644
--- a/frontend/src/AGENTS.md
+++ b/frontend/src/AGENTS.md
@@ -86,6 +86,35 @@ That is a normal working setup, not an edge case, and it is the case agents skip
- **Do not build for mobile.** No phone-width layouts, no touch-sized targets, no `sm:` variants for a viewport nobody runs the app at. "Narrow" means a docked panel on a laptop.
- **Look at it, don't reason about it.** Render the surface at a few widths before calling the work done. A story with a pinned container width snapshots the narrow case, so a regression shows up in visual review.
+## Rule 7 — Don't leave a changing bare text node next to siblings
+
+Page-translation extensions (Chrome and Edge in-page translate, the Google Translate widget) replace each text node they translate with a `<font>` element.
+React keeps pointing at the original node, which produces two defects — both of which land hardest on users outside English-speaking markets, since they're the ones with translation turned on:
+
+- **A crash.** Removing that text node, or inserting a sibling before it, throws `NotFoundError: Failed to execute 'removeChild' on 'Node'` ([react#11538](https://github.com/facebook/react/issues/11538)). `ErrorBoundary` remounts the subtree instead of dropping the scene, so this degrades rather than breaks — but a remount is still a backstop, not a licence to render the shape: it discards whatever state that subtree held.
+- **Silent staleness.** A text-only update writes `nodeValue` on the detached node, so the text freezes at whatever the extension translated. Live timers and countdowns just stop, and no backstop catches that.
+
+The hazard is specifically a **bare text node that has siblings**, because that's the only shape React tracks as its own node:
+
+```tsx
+<div>Computed {lastRefresh.fromNow()}</div> {/* hazard: two bare text nodes */}
+<>{formatElapsed(seconds)}</> {/* hazard: a bare text node in the parent's children */}
+<span>{lastRefresh.fromNow()}</span> {/* safe: sole child, React writes parent.textContent */}
+```
+
+A sole text child is immune, so don't add anything there.
+For the hazardous shape, either wrap the changing part in its own element, or mark it `translate="no"`, or both:
+
+```tsx
+<span>Computed&nbsp;</span>
+<span translate="no">{lastRefresh.fromNow()}</span>
+```
+
+Scope it to the changing part and keep the static labels around it translatable.
+Nearly all of these render numbers, dates, or durations, so nothing of value goes untranslated.
+`queries/nodes/InsightViz/ComputationTimeWithRefresh` and `scenes/experiments/MetricsView/new/ElapsedTime` are the exemplars.
+A whole subtree of machine data (an event feed, an ID column) opts out at its container instead — `scenes/activity/live/LiveEventsFeed` marks every row `translate="no"` and leaves the headers translatable.
+
## Typecheck & typegen cadence (don't over-run these)
These are slow; run them at the right moment, not after every edit.
diff --git a/frontend/src/layout/ErrorBoundary/ErrorBoundary.test.tsx b/frontend/src/layout/ErrorBoundary/ErrorBoundary.test.tsx
new file mode 100644
index 000000000000..b44660e96eee
--- /dev/null
+++ b/frontend/src/layout/ErrorBoundary/ErrorBoundary.test.tsx
@@ -0,0 +1,98 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { Provider } from 'kea'
+
+import { initKeaTests } from '~/test/init'
+
+import { ErrorBoundary } from './ErrorBoundary'
+
+const REMOVE_CHILD_MESSAGE =
+ "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."
+
+let renderAttempts = 0
+let throwUntilAttempt = 0
+let thrownMessage = REMOVE_CHILD_MESSAGE
+
+/**
+ * Throws on every render attempt up to `throwUntilAttempt`. React retries a failed render twice
+ * before it gives the error to a boundary, so three throws is the smallest count that reaches one.
+ */
+function Unstable(): JSX.Element {
+ renderAttempts += 1
+ if (renderAttempts <= throwUntilAttempt) {
+ throw new Error(thrownMessage)
+ }
+ return <div>recovered content</div>
+}
+
+describe('ErrorBoundary', () => {
+ let consoleErrorSpy: jest.SpyInstance
+
+ beforeEach(() => {
+ initKeaTests()
+ renderAttempts = 0
+ throwUntilAttempt = 0
+ thrownMessage = REMOVE_CHILD_MESSAGE
+ consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
+ })
+
+ afterEach(() => {
+ cleanup()
+ consoleErrorSpy.mockRestore()
+ })
+
+ function renderBoundary(): void {
+ render(
+ <Provider>
+ <ErrorBoundary>
+ <Unstable />
+ </ErrorBoundary>
+ </Provider>
+ )
+ }
+
+ // A translated page throws on the commit that touches a replaced text node, and a fresh render
+ // of the same subtree succeeds. Before the remount, that one commit cost the user the scene.
+ it('remounts its children after a DOM mutation error, with no crash screen', async () => {
+ throwUntilAttempt = 3
+ renderBoundary()
+
+ expect(await screen.findByText('recovered content')).toBeInTheDocument()
+ expect(screen.queryByText('An error has occurred')).not.toBeInTheDocument()
+ })
+
+ it('stops remounting and shows the fallback when the DOM mutation error repeats', async () => {
+ throwUntilAttempt = Number.POSITIVE_INFINITY
+ renderBoundary()
+
+ expect(await screen.findByText('An error has occurred')).toBeInTheDocument()
+ expect(screen.getByText(/translation/i)).toBeInTheDocument()
+ // A remount loop against a subtree that always throws would never reach that fallback.
+ expect(renderAttempts).toBeLessThan(20)
+ })
+
+ it('shows the fallback at once for an error that is not a DOM mutation', () => {
+ thrownMessage = 'something else broke'
+ throwUntilAttempt = 3
+ renderBoundary()
+
+ expect(screen.getByText('An error has occurred')).toBeInTheDocument()
+ expect(screen.queryByText(/translation/i)).not.toBeInTheDocument()
+ })
+
+ // The app-root boundary in scenes/App.tsx has no key to remount it, so without an in-fallback
+ // reset a crash outside a scene (nav, command palette) can only be cleared by a reload.
+ it('re-renders its children when the user clicks Try again', async () => {
+ thrownMessage = 'something else broke'
+ throwUntilAttempt = 3
+ renderBoundary()
+ expect(screen.getByText('An error has occurred')).toBeInTheDocument()
+
+ await userEvent.click(screen.getByText('Try again'))
+
+ expect(screen.getByText('recovered content')).toBeInTheDocument()
+ expect(screen.queryByText('An error has occurred')).not.toBeInTheDocument()
+ })
+})
diff --git a/frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx b/frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx
index e4571d08c948..cdd193d58046 100644
--- a/frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx
+++ b/frontend/src/layout/ErrorBoundary/ErrorBoundary.tsx
@@ -2,6 +2,8 @@ import './ErrorBoundary.scss'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
+import { useCallback, useEffect, useRef, useState } from 'react'
import { IconCopy } from '@posthog/icons'
import { PostHogErrorBoundary, type PostHogErrorBoundaryFallbackProps } from '@posthog/react'
@@ -18,11 +20,49 @@ const DOM_MUTATION_PATTERNS = [
"Failed to execute 'appendChild' on 'Node'",
]
+/**
+ * These throw when something outside React rewrites DOM that React still holds, which in practice
+ * means in-page translation that replaces text nodes with `<font>` wrappers (react#11538). Render
+ * sites can opt out of translation to stop the shape at the source, but `{cond && 'text'}` is
+ * common all over the app, so this branch is what keeps the untreated ones from costing a scene.
+ */
function isDOMModificationError(error: Error): boolean {
const message = error.message || ''
return DOM_MUTATION_PATTERNS.some((pattern) => message.includes(pattern))
}
+/**
+ * Two silent remounts, then the fallback. That is enough for a page the translator rewrote once,
+ * and few enough that a subtree which crashes on every render still settles on the fallback.
+ */
+const MAX_CONSECUTIVE_REMOUNTS = 2
+/** A crash this long after the last remount is a new incident, not the same remount loop. */
+const REMOUNT_WINDOW_MS = 5000
+/**
+ * The `$exception` is captured before this boundary decides what to do with it, so it cannot say
+ * whether the scene survived. That is what this event is for. A tab that stays translated can
+ * keep triggering the remount all day, and each one is the same fact, so cap the reports.
+ */
+const MAX_REPORTED_REMOUNTS = 3
+let reportedRemounts = 0
+
+/** Asks for the remount from an effect, so the fallback's render stays free of side effects. */
+function RemountOnMount({ onRemount }: { onRemount: () => void }): null {
+ useEffect(() => {
+ onRemount()
+ }, [onRemount])
+ return null
+}
+
+interface RemountRecord {
+ count: number
+ at: number
+}
+
+function canRemountSilently(record: RemountRecord, now: number): boolean {
+ return now - record.at > REMOUNT_WINDOW_MS || record.count < MAX_CONSECUTIVE_REMOUNTS
+}
+
interface ErrorBoundaryProps {
children?: React.ReactNode
exceptionProps?: Record<string, number | string | boolean | bigint | symbol | null | undefined>
@@ -32,6 +72,30 @@ interface ErrorBoundaryProps {
export function ErrorBoundary({ children, exceptionProps = {}, className }: ErrorBoundaryProps): JSX.Element {
const { currentTeamId } = useValues(teamLogic)
const { openSupportForm } = useActions(supportLogic)
+ // PostHogErrorBoundary keeps the caught error in its own state and exposes no reset, so a new
+ // key is the only route back to rendering children. Without it the app-root boundary in
+ // scenes/App.tsx is terminal: it has no key that ever changes, unlike the per-scene boundary
+ // that resets whenever the scene does, so anything thrown from the nav or the command palette
+ // leaves a page reload as the only way out.
+ const [remountCount, setRemountCount] = useState(0)
+ const remounts = useRef<RemountRecord>({ count: 0, at: 0 })
+
+ const remountAfterDOMMutation = useCallback((): void => {
+ const now = Date.now()
+ const isNewIncident = now - remounts.current.at > REMOUNT_WINDOW_MS
+ const count = isNewIncident ? 1 : remounts.current.count + 1
+ remounts.current = { count, at: now }
+ if (reportedRemounts < MAX_REPORTED_REMOUNTS) {
+ reportedRemounts += 1
+ posthog.capture('error_boundary_dom_mutation_remounted', { attempt: count })
+ }
+ setRemountCount((previous) => previous + 1)
+ }, [])
+
+ const retryFromFallback = useCallback((): void => {
+ remounts.current = { count: 0, at: 0 }
+ setRemountCount((previous) => previous + 1)
+ }, [])
const additionalProperties = { ...exceptionProps }
@@ -41,6 +105,7 @@ export function ErrorBoundary({ children, exceptionProps = {}, className }: Erro
return (
<PostHogErrorBoundary
+ key={remountCount}
additionalProperties={additionalProperties}
fallback={(props: PostHogErrorBoundaryFallbackProps) => {
const rawError = props.error
@@ -52,7 +117,15 @@ export function ErrorBoundary({ children, exceptionProps = {}, className }: Erro
const exceptionEvent = props.exceptionEvent as SupportTicketExceptionEvent
- const isBrowserExtensionError = isDOMModificationError(normalizedError)
+ const isPageRewrittenError = isDOMModificationError(normalizedError)
+
+ // This error class is transient: the commit that hit a translated text node
+ // failed, but a fresh render of the same subtree usually succeeds. So remount the
+ // subtree instead of replacing the scene. Translated nodes React thinks it removed
+ // can stay on screen, which is a much smaller loss than the whole view.
+ if (isPageRewrittenError && canRemountSilently(remounts.current, Date.now())) {
+ return <RemountOnMount onRemount={remountAfterDOMMutation} />
+ }
const errorDetails = [
exceptionEvent?.uuid ? `Exception ID: ${exceptionEvent.uuid}` : null,
@@ -64,24 +137,11 @@ export function ErrorBoundary({ children, exceptionProps = {}, className }: Erro
return (
<div className={clsx('ErrorBoundary', className)}>
<h2>An error has occurred</h2>
- {isBrowserExtensionError && (
- <LemonBanner
- type="warning"
- className="mb-2"
- action={{
- children: 'Email an engineer',
- onClick: () => {
- openSupportForm({
- kind: 'bug',
- isEmailFormOpen: true,
- exception_event: exceptionEvent ?? null,
- })
- },
- }}
- >
- This error is commonly caused by browser extensions (such as translation or ad-blocking
- extensions) that modify the page. Try disabling your browser extension(s) and reloading
- the page to avoid this error in the future.
+ {isPageRewrittenError && (
+ <LemonBanner type="warning" className="mb-2">
+ Page translation stopped PostHog from updating this view, and it kept happening after we
+ reloaded the view for you. This is usually your browser's built-in translation, or an
+ extension that translates the page. Turn translation off for this site, then try again.
</LemonBanner>
)}
<pre>
@@ -98,43 +158,43 @@ export function ErrorBoundary({ children, exceptionProps = {}, className }: Erro
{exceptionEvent?.uuid && (
<div className="text-muted text-xs mb-2">Exception ID: {exceptionEvent.uuid}</div>
)}
- {!isBrowserExtensionError && (
- <>
- <p className="mb-2">
- Click below to send this to an engineer.{' '}
- {exceptionEvent
- ? "We'll attach the exception ID, stack trace, and session replay automatically"
- : "We'll attach the session replay automatically"}{' '}
- — just tell us what you were doing, and add a screenshot if you think it will help.
- </p>
- <div className="flex gap-2 flex-wrap">
- <LemonButton
- type="primary"
- center
- onClick={() => {
- openSupportForm({
- kind: 'bug',
- isEmailFormOpen: true,
- exception_event: exceptionEvent ?? null,
- })
- }}
- className="flex-1"
- >
- Email an engineer
- </LemonButton>
- <LemonButton
- type="secondary"
- center
- icon={<IconCopy />}
- onClick={() => void copyToClipboard(errorDetails, 'error details')}
- disabledReason={!errorDetails ? 'No details to copy' : undefined}
- className="flex-1"
- >
- Copy error details
- </LemonButton>
- </div>
- </>
- )}
+ <p className="mb-2">
+ Try again first. If the error comes back, send it to an engineer.{' '}
+ {exceptionEvent
+ ? "We'll attach the exception ID, stack trace, and session replay automatically"
+ : "We'll attach the session replay automatically"}
+ , so you only need to tell us what you were doing. Add a screenshot if you think it will
+ help.
+ </p>
+ <div className="flex gap-2 flex-wrap">
+ <LemonButton type="primary" center onClick={retryFromFallback} className="flex-1">
+ Try again
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ center
+ onClick={() => {
+ openSupportForm({
+ kind: 'bug',
+ isEmailFormOpen: true,
+ exception_event: exceptionEvent ?? null,
+ })
+ }}
+ className="flex-1"
+ >
+ Email an engineer
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ center
+ icon={<IconCopy />}
+ onClick={() => void copyToClipboard(errorDetails, 'error details')}
+ disabledReason={!errorDetails ? 'No details to copy' : undefined}
+ className="flex-1"
+ >
+ Copy error details
+ </LemonButton>
+ </div>
</div>
)
}}
diff --git a/frontend/src/lib/components/ProductSetup/ProductSetupPopover.tsx b/frontend/src/lib/components/ProductSetup/ProductSetupPopover.tsx
index dad2fc1b287f..229934b0353e 100644
--- a/frontend/src/lib/components/ProductSetup/ProductSetupPopover.tsx
+++ b/frontend/src/lib/components/ProductSetup/ProductSetupPopover.tsx
@@ -374,7 +374,9 @@ function PopoverHeader({
<div className="px-3 py-2 border-b border-border">
<div className="text-center py-2">
<span className="text-lg">🎉</span>
- <p className="font-semibold text-sm mt-1">You've completed {productName}!</p>
+ <p className="font-semibold text-sm mt-1">
+ You've completed <span translate="no">{productName}</span>!
+ </p>
{otherProductsWithTasks.length > 0 ? (
<p className="text-xs text-muted">Try another product to continue your setup</p>
) : (
@@ -398,7 +400,10 @@ function PopoverHeader({
options={productOptions}
/>
)}
- <span className="text-xs text-muted ml-auto">
+ {/* Three bare text nodes that change as tasks complete. React tracks each one, so
+ after page translation swaps them for `<font>` wrappers the next update throws
+ (react#11538). Counts have nothing to translate. */}
+ <span className="text-xs text-muted ml-auto" translate="no">
{completedCount}/{totalTasks}
</span>
</div>
@@ -473,7 +478,9 @@ function ProductSuggestionItem({ product, onSelect }: ProductSuggestionItemProps
>
<IconTarget className="w-4 h-4 text-muted" />
<span className="flex-1 text-sm">{product.name}</span>
- <span className="text-xs text-muted">{product.remainingCount} tasks</span>
+ <span className="text-xs text-muted">
+ <span translate="no">{product.remainingCount}</span> tasks
+ </span>
</div>
)
}
@@ -502,13 +509,19 @@ function TaskHoverDescription({ task, anchored = false }: TaskHoverDescriptionPr
{task.lockedReason && (
<p className="text-xs text-warning mt-auto pt-1">
<strong>Depends on:</strong>{' '}
- {task.lockedReason.replace('Complete "', '').replace('" first', '')}
+ {/* The hover card mounts and unmounts on every task hover, and this
+ text node sits next to element siblings. On a translated page React
+ inserts before, or removes, a node it no longer owns, and the commit
+ throws (react#11538). Its own element keeps the node React tracks
+ the sole child of a parent React can rewrite whole. */}
+ <span>{task.lockedReason.replace('Complete "', '').replace('" first', '')}</span>
</p>
)}
{task.requiresManualCompletion && !task.completed && !task.skipped && (
<p className="text-xs text-muted mt-1 italic">
- Manual task – {task.docsUrl ? 'click for instructions, then ' : ''}
- mark as complete when done.
+ <span>Manual task – </span>
+ {task.docsUrl ? <span>click for instructions, then </span> : null}
+ <span>mark as complete when done.</span>
</p>
)}
</>
diff --git a/frontend/src/queries/nodes/DataNode/ElapsedTime.tsx b/frontend/src/queries/nodes/DataNode/ElapsedTime.tsx
index fa4fa0b00e63..882d8f26ba70 100644
--- a/frontend/src/queries/nodes/DataNode/ElapsedTime.tsx
+++ b/frontend/src/queries/nodes/DataNode/ElapsedTime.tsx
@@ -173,6 +173,7 @@ function ElapsedTimeWithTimings({
<div
onClick={() => setPopoverVisible((visible) => !visible)}
className={clsx(hasError ? 'text-danger' : '', 'cursor-help')}
+ translate="no"
>
{(elapsedTime / 1000).toFixed(elapsedTime < 1000 ? 2 : 1)}s
</div>
@@ -209,5 +210,12 @@ export function ElapsedTime({ showTimings }: { showTimings?: boolean }): JSX.Ele
return <ElapsedTimeWithTimings elapsedTime={elapsedTime} timings={timings} hasError={!!responseError} />
}
- return <div className={responseError ? 'text-danger' : ''}>{(time / 1000).toFixed(time < 1000 ? 2 : 1)}s</div>
+ // "{time}s" is two bare text nodes, so React tracks them individually. Once a page-translation
+ // extension replaces one with a <font> element React's updates go to the detached node and the
+ // counter freezes mid-query (react#11538). There is nothing to translate in "1.4s" anyway.
+ return (
+ <div className={responseError ? 'text-danger' : ''} translate="no">
+ {(time / 1000).toFixed(time < 1000 ? 2 : 1)}s
+ </div>
+ )
}
diff --git a/frontend/src/queries/nodes/InsightViz/ComputationTimeWithRefresh.tsx b/frontend/src/queries/nodes/InsightViz/ComputationTimeWithRefresh.tsx
index 72a98748ead9..6e824a670800 100644
--- a/frontend/src/queries/nodes/InsightViz/ComputationTimeWithRefresh.tsx
+++ b/frontend/src/queries/nodes/InsightViz/ComputationTimeWithRefresh.tsx
@@ -34,7 +34,13 @@ export function ComputationTimeWithRefresh({ disableRefresh }: { disableRefresh?
return (
<div className="flex items-center text-secondary z-10">
- Computed {lastRefresh ? dayjs(lastRefresh).fromNow() : 'a while ago'}
+ {/* Both halves get their own element so neither is a bare text node React tracks: once a
+ page-translation extension replaces such a node with a <font> element, React's writes
+ land on the detached node and the time freezes, and removing it throws
+ removeChild NotFoundError (react#11538). The relative time also opts out of
+ translation, since it is rewritten every 15s. */}
+ <span>Computed&nbsp;</span>
+ <span translate="no">{lastRefresh ? dayjs(lastRefresh).fromNow() : 'a while ago'}</span>
{!disableRefresh && (
<>
<span className="px-1">•</span>
diff --git a/frontend/src/scenes/activity/live/LiveEventsFeed.tsx b/frontend/src/scenes/activity/live/LiveEventsFeed.tsx
index 8356631b20be..97a6edbd2dbb 100644
--- a/frontend/src/scenes/activity/live/LiveEventsFeed.tsx
+++ b/frontend/src/scenes/activity/live/LiveEventsFeed.tsx
@@ -133,6 +133,12 @@ export function LiveEventsFeed({
columns={tableColumns}
data-attr="live-events-table"
rowKey="uuid"
+ // Each incoming batch re-keys the whole feed, so React removes and reorders row text on
+ // almost every streaming update. On a translated page each of those text nodes is a
+ // `<font>` wrapper React does not own, and the commit throws (react#11538). Rows hold
+ // event names, distinct IDs, URLs, and timestamps, so nothing here needs translation.
+ // The column headers stay outside the opt-out and stay translatable.
+ onRow={() => ({ translate: 'no' })}
dataSource={events}
useURLForSorting={false}
emptyState={emptyState ?? defaultEmptyState}
diff --git a/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.test.tsx b/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.test.tsx
new file mode 100644
index 000000000000..08018d7e0a81
--- /dev/null
+++ b/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.test.tsx
@@ -0,0 +1,45 @@
+import { act, render } from '@testing-library/react'
+
+import { ElapsedTime } from './ElapsedTime'
+
+/**
+ * Models what Chrome's and Edge's in-page translation actually do to the DOM: every translatable
+ * text node is replaced by a `<font>` element holding the translated text, and `translate="no"`
+ * subtrees are left alone. React keeps pointing at the original node, so removing it later throws
+ * `NotFoundError: Failed to execute 'removeChild' on 'Node'` (react#11538).
+ */
+function simulatePageTranslation(root: HTMLElement): void {
+ const walk = (node: Node): void => {
+ if (node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).getAttribute('translate') === 'no') {
+ return
+ }
+ for (const child of Array.from(node.childNodes)) {
+ if (child.nodeType === Node.TEXT_NODE && child.textContent?.trim()) {
+ const translated = document.createElement('font')
+ translated.textContent = `翻译:${child.textContent}`
+ node.replaceChild(translated, child)
+ } else {
+ walk(child)
+ }
+ }
+ }
+ walk(root)
+}
+
+describe('ElapsedTime', () => {
+ // Mirrors the TimeseriesModal call site, where the elapsed time is followed by a sibling text node.
+ const Host = ({ startTime }: { startTime: string | null }): JSX.Element => (
+ <div>
+ <ElapsedTime startTime={startTime} /> elapsed
+ </div>
+ )
+
+ it('survives a translated page when the recalculation finishes', () => {
+ const { container, rerender } = render(<Host startTime="2026-07-29T00:00:00Z" />)
+ simulatePageTranslation(container)
+
+ // Dropping startTime unmounts the elapsed time, which is where React removes the node the
+ // translation swapped out from under it.
+ expect(() => act(() => rerender(<Host startTime={null} />))).not.toThrow()
+ })
+})
diff --git a/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.tsx b/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.tsx
index 84609502e724..6deeb236fecc 100644
--- a/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/new/ElapsedTime.tsx
@@ -39,5 +39,9 @@ export function ElapsedTime({ startTime }: ElapsedTimeProps): JSX.Element | null
return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`
}
- return <>{formatElapsedTime(elapsedSeconds)}</>
+ // Wrapped in an element rather than returned bare, because a bare text node lands among the
+ // caller's children and React removes it directly once `startTime` goes away. If a
+ // page-translation extension has swapped it for a <font> element by then, that removal throws
+ // removeChild NotFoundError (react#11538). A clock has nothing to translate anyway.
+ return <span translate="no">{formatElapsedTime(elapsedSeconds)}</span>
}
diff --git a/frontend/src/scenes/experiments/MetricsView/shared/MetricRetryState.tsx b/frontend/src/scenes/experiments/MetricsView/shared/MetricRetryState.tsx
index ef179ac057a7..5cb4c20126c9 100644
--- a/frontend/src/scenes/experiments/MetricsView/shared/MetricRetryState.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/shared/MetricRetryState.tsx
@@ -68,7 +68,10 @@ export function MetricRetryDetails({ retry, className }: { retry: MetricRetryInf
</div>
)}
<div className="text-muted text-xs">
- Retry {retry.attempt} of {retry.max_attempts} · next attempt {countdown} ·{' '}
+ {/* `countdown` is rewritten every second. Left bare it is a text node React tracks,
+ so once a page-translation extension replaces it with a <font> element the
+ countdown freezes at the translated value (react#11538). */}
+ Retry {retry.attempt} of {retry.max_attempts} · next attempt <span translate="no">{countdown}</span> ·{' '}
{/* <Link to={RECALCULATION_RETRY_DOCS_URL} target="_blank">
Why do we retry?
</Link> */}
diff --git a/frontend/src/scenes/experiments/MetricsView/shared/RecalculationStatus.tsx b/frontend/src/scenes/experiments/MetricsView/shared/RecalculationStatus.tsx
index 595c8dd99667..7952e46f14e4 100644
--- a/frontend/src/scenes/experiments/MetricsView/shared/RecalculationStatus.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/shared/RecalculationStatus.tsx
@@ -170,8 +170,15 @@ function ClimbingRows({ rowsRead, estimatedRows }: { rowsRead: number; estimated
return (
<span className="text-muted text-xs whitespace-nowrap">
- · {humanFriendlyNumber(animatedRowsRead, 0)}
- {showCeiling && ` / ${humanFriendlyNumber(animatedEstimatedTotal, 0)}`} rows read
+ {/* The counts are bare text nodes React tracks individually, and the `showCeiling` one
+ comes and goes. Once a page-translation extension replaces them with <font> elements,
+ removing one throws removeChild NotFoundError and the rest freeze at the translated
+ value (react#11538). Only the numbers opt out of translation. */}
+ <span translate="no">
+ · {humanFriendlyNumber(animatedRowsRead, 0)}
+ {showCeiling && ` / ${humanFriendlyNumber(animatedEstimatedTotal, 0)}`}
+ </span>{' '}
+ rows read
</span>
)
}
diff --git a/products/replay_vision/frontend/components/ObservationProgressBar.tsx b/products/replay_vision/frontend/components/ObservationProgressBar.tsx
index 874b7dd1da29..1070c47314fb 100644
--- a/products/replay_vision/frontend/components/ObservationProgressBar.tsx
+++ b/products/replay_vision/frontend/components/ObservationProgressBar.tsx
@@ -112,9 +112,13 @@ export function ObservationProgressBar({
<div className="flex flex-col gap-1.5">
<div className="flex items-center gap-2 text-muted text-sm">
<Spinner textColored />
+ {/* `detail` ticks every second and comes and goes. Left bare it is a text node
+ React tracks, so a page-translation extension replacing it with a <font>
+ element freezes it and makes its removal throw removeChild NotFoundError
+ (react#11538). The phase label is static and stays translatable. */}
<span>
{PHASE_LABELS[activePhase]}
- {detail}…
+ <span translate="no">{detail}</span>…
</span>
</div>
<LemonProgress percent={overallPercent} />
@@ -137,7 +141,11 @@ export function ObservationProgressBar({
<PhaseStatusIcon status={status} />
<span className="truncate">
{PHASE_LABELS[phase]}
- {detail ? <span className="text-muted-alt">&nbsp;({detail})</span> : null}
+ {detail ? (
+ <span className="text-muted-alt" translate="no">
+ &nbsp;({detail})
+ </span>
+ ) : null}
</span>
</div>
<div className="pl-6">