Skip to content

[Due for payment 2026-08-10] [$250] [Sentry: APP-GVV] IndexSizeError restoring markdown cursor on IOU description step #95347

Description

@mountiny

Sentry

https://expensify.sentry.io/issues/APP-GVV

Impact (snapshot at filing)

  • Users (total since first seen): 1
  • Events: 1
  • Users (last 14d): 1
  • First seen: 2026-07-02
  • Last seen: 2026-07-02
  • Platform: web
  • App version(s): 9.4.25-2
  • Affected route(s) (parameterized): /create/submit/description/:action/:iouType/:transactionID
  • Mechanism: auto.browser.global_handlers.onerror

Stack trace (top frames, first-party only)

IOURequestStepDescription.tsx:172 (t16) → inputRef.current?.focus()
useDiscardChangesConfirmation/index.ts:80 → onCancel?.()
MarkdownTextInput.web.js:411 (handleFocus) → setCursorPosition
cursorUtils.js:27 (setCursorPosition) → range.setStart

Suspected cause

useDiscardChangesConfirmation onCancel calls inputRef.focus() which triggers live-markdown setCursorPosition with stale DOM offsets after the description field content changed.

Reproduction

  1. Open expense description step in create/submit flow.
  2. Edit description, then cancel/discard changes (triggering discard confirmation).
  3. Observe IndexSizeError on Range.setStart in console.

Related

  • Sibling Sentry IDs (if any): none
  • Prior GH issues: none
Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @suneox

Metadata

Metadata

Labels

DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue

Type

No type

Projects

Status
SUBISSUE

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions