Skip to content

fix(customer-modal): replace Mantine Autocomplete with native input (React 19 ref warning)#1662

Open
giladresisi wants to merge 1 commit into
mainfrom
fix/customer-modal-react19-ref-warning
Open

fix(customer-modal): replace Mantine Autocomplete with native input (React 19 ref warning)#1662
giladresisi wants to merge 1 commit into
mainfrom
fix/customer-modal-react19-ref-warning

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

Why this change (the problem)

Opening the Customer modal — e.g. when adding a channel into a new group — throws a React 19 console error:

Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.

Origin: src/components/launches/customer.modal.tsx rendering @mantine/core's <Autocomplete>. The real cause is @mantine/core@5.10.5 (Mantine v5, built for React 17/18) running under React 19.2.4 — the library internally accesses the now-removed element.ref. It's a console error (not a hard crash), but it's noisy and user-visible in dev.

The fix

Replace the single <Autocomplete> with a native <input> + <datalist>, styled to match the app's existing inputs. Preserves the important behaviors:

  • Free-text entry (needed to create a new customer/group by typing a new name)
  • Existing-name suggestions from GET /integrations/customers

Save/remove logic and the PUT /integrations/:id/customer-name endpoint are untouched.

Why this solution (and not upgrading Mantine)

The alternative was to bump @mantine/core to a React 19-compatible major (v8). That was clearly unfavorable:

  • Mantine is used in only two files in the frontend — it's a vestigial dependency.
  • Project convention is to prefer native components over npm UI libraries.
  • A v5 → v8 bump is a large breaking change (both files would need reworking) carrying far more risk than removing one component.

So we removed the component instead of dragging in a major dependency upgrade.

Scope & risk

  • Changed one file (customer.modal.tsx). @mantine/core stays in package.json (still used by layout/language.component.tsx), so no dependency/build impact elsewhere.
  • Main trade-off: the suggestion dropdown is now browser-native (styling differs across Chrome/Safari/Firefox) rather than Mantine-themed.
  • Note: the same React 19 element.ref warning can still originate from language.component.tsx (also Mantine v5); fully removing Mantine is out of scope here.

Testing

Verified manually: the console error is gone; typing shows existing customer suggestions; typing a new name + Save creates/assigns the group and persists; opening for an already-assigned channel pre-fills the name and "Remove from customer" works; empty save is a no-op.

🤖 Generated with Claude Code

…o fix React 19 warning

The CustomerModal rendered `@mantine/core`'s `<Autocomplete>`, which triggered a
React 19 console error ("Accessing element.ref was removed in React 19. ref is now
a regular prop.") whenever the modal opened (e.g. adding a channel to a new group).
The root cause is `@mantine/core@5.10.5` (Mantine v5, built for React 17/18) running
under React 19, where the library internally accesses the now-removed `element.ref`.

Replaced the single Autocomplete usage with a native `<input>` + `<datalist>`,
styled to match the app's inputs. Free-text entry (needed to create a new
customer/group) and existing-name suggestions are preserved. Scoped entirely to
customer.modal.tsx; no dependency or behavior changes elsewhere.

The alternative was to upgrade @mantine/core to a React 19-compatible major (v8),
which was clearly unfavorable: Mantine is used in only two files, the project's
convention is to prefer native components over npm UI libraries, and a v5->v8 bump
is a large breaking change carrying far more risk than removing one component.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Jul 1, 2026
@postiz-contribution

Copy link
Copy Markdown

Contribution-checker quality warning
Heuristic score: 7/100 (low). This is a non-blocking warning surfaced by the project's quality settings.

Heuristics that flagged:

  • Excessive inline code references: 17 inline refs (>3)
  • PR doesn't use the repo's PR template: 5 required checkbox items missing (max 1, match ≥80%)
  • Body adds too many extra headers beyond the template: 5 extra headers (>1)
  • AI watermark phrase: Matched: "Generated with Claude Code"
  • Commit message too long: Longest: 1191 chars

If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it.

@postiz-agent

postiz-agent Bot commented Jul 1, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant