Skip to content

Decide iOS 12 support: String.prototype.matchAll still used in 9 client paths (follow-up to #1698) #1701

Description

@feruzm

#1698 removed String.prototype.matchAll from deploy-skew.ts because it is Safari 13+ and the call was throwing on iOS 12.5.8 (ECENCY-NEXT-1GNZ). That path had to be fixed on its own terms: it runs inside Sentry's beforeSend, so a throw there makes the SDK drop the event it was processing and report the TypeError instead. Every real error from that browser was lost.

The API is still called from other client paths, which will throw the same way on the same browsers:

  • apps/web/src/features/chat/hooks/use-message-rendering.tsx:219
  • apps/web/src/app/publish/_components/publish-validate-post.tsx:269
  • apps/web/src/app/decks/_components/deck-threads-form/deck-threads-form-control.tsx:36
  • packages/sdk/src/modules/search/query-builder.ts:161 and :193
  • packages/render-helper/src/catch-post-image.ts:356, :470, :669, :745

Next's polyfill bundle is emitted with noModule. Safari 12 does support modules, so that bundle never executes there. Anything ES2020-and-later that is a runtime API rather than syntax is therefore missing, matchAll included. Syntax is fine, since SWC transpiles ?. and ?? down.

Decision needed first

This is a support-boundary question, not a bug list. Two coherent answers:

  1. iOS 12 is in scope. Import a String.prototype.matchAll polyfill in the client bootstrap, behind a feature check so modern browsers pay nothing beyond the check. One place, covers all nine sites plus whatever gets written next.
  2. iOS 12 is out of scope. Change nothing here. Those users get a broken chat renderer or search box, which is what an unsupported browser means. fix(deploy-skew): prevent TypeError: matchAll is not a function on older Safari #1698 stands regardless, because the error-reporting path must not throw whatever we decide.

Volume argues for option 2: ECENCY-NEXT-1GNZ was one user in the only occurrence we have. Worth confirming against Plausible's browser breakdown before choosing.

Whichever way it goes, the rule that came out of #1698 stays: code reachable from beforeSend or from an error boundary may not call an API newer than our oldest supported engine, since a throw there costs the whole report. deploy-skew.ts now carries a comment saying so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions