[PF-2292] Unlock picass-rich-text-editor React v19 - #5072
Open
azebich wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: d77af1e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
📖 Storybook Preview 🚀 Your Storybook preview is ready: View Storybook 📍 Preview URL: This preview is updated automatically when you push changes to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PF-2292
Description
Remove the
@emoji-mart/reactdependency from@toptal/picasso-rich-text-editorand render emoji-mart's
Pickerthrough a small local component instead, so thepackage no longer carries a
reactpeer range that excludes React 19. Thisunblocks the peer-cap lift on the PF-2262 branch; Picasso's own
reactpeer isuntouched here.
Why not just upgrade.
@emoji-mart/react@1.1.1is the latest release — lastpublished January 2023 — and declares
react: ^16.8 || ^17 || ^18. No versionexists that supports React 19, so there is nothing to bump to. Relaxing the peer
locally (pnpm patch or
peerDependencyRules) would fix only this repo's install:patches aren't published, so consumers on React 19 would still resolve
@emoji-mart/react@1.1.1and hit a peer warning or a failed install.Owning the wrapper is cheap and permanent. It was ~20 lines, exactly one file
imported it, and
emoji-martplus@emoji-mart/datawere already directdependencies — so nothing is added to the dependency tree, only removed.
The new component (
EmojiMartPicker) constructs thePickeron the firstcommit and feeds later prop changes through
picker.update(props)— both fromeffects. The upstream wrapper called
updateduring render, which is arender-phase side effect; owning the code let us fix that. It also nulls its
instance on unmount.
It is fully typed with no escape hatches:
Pickerimports fromemoji-martasboth a value and a type, so there is no
anyand no boundary cast at all.datais deliberately typed
unknown—@emoji-mart/data's.d.tsexports onlyinterfaces with no default export, so typing it as
EmojiMartDatawould break thecall site.
One call-site change:
onClickOutside={showEmojiPicker && closePicker}passedliteral
falsewhen closed and now passesundefined. Both are falsy toemoji-mart, so this is parity rather than a behaviour change.
Not addressed here, deliberately:
opacity-0until toggled,so Happo almost certainly never captures it open. Adding one would genuinely
improve coverage but moves the visual baseline, so it deserves its own decision.
emoji-martcallscustomElements.define(...)and probescanvas at module scope, so importing it needs a DOM. That is pre-existing — the
old import chain reached the same module — and this change neither improves nor
worsens it.
emoji-mart5.5.2 → 5.6.0 (which would enable the Emoji 15 additions) istracked as a separate follow-up ticket, since it is a user-visible content
change and not a React 19 blocker.
How to test
the picker opens and closes, standard emojis insert into the editor, and the
custom emojis from that story's
customEmojisstill appear and insert.Escapecloses the picker, and that clicking outside it closes it.Note the new unit test proves the picker mounts, but cannot exercise its UI — the
picker's contents live in a shadow DOM that testing-library cannot query. The
manual pass above is the real verification.
Verified locally:
@emoji-mart/reactis gone from the manifest,pnpm-lock.yaml(0 occurrences)and
node_modules; no reference remains anywhere in the repoemoji-mart@5.5.2and@emoji-mart/data@1.2.1unchanged — nothing addedtsc -b --forceexit 0 forpicasso-rich-text-editorandpicasso-forms(its only dependent)
identical results; picasso-forms 17 suites / 66 tests / 11 snapshots pass
--fix) reported nothing and rewrote nothing; Prettierclean on all touched files
em-emoji-pickeris a custom element onlyemoji-mart creates, so it fails if the picker never mounts
Screenshots
No visual change is intended — the picker renders the same emoji-mart element as
before, just constructed by our own component. The Happo report is the evidence;
see How to test.
Development checks
patchfor@toptal/picasso-rich-text-editor: internal implementation change, no public API changepicasso-tailwind-mergerequires major update (check itsREADME.md) — n/a, no Tailwind or styling changespropsin component with documentation — the new internal component's props are JSDoc'd; no public props added or changedexamplesfor component — n/a, no new public component; the picker is already covered by the RichText storyBreaking change
Not a breaking change — no public API change and no codemod needed. The only
theoretical impact is on a consumer that imported
@emoji-mart/reactwithoutdeclaring it and relied on Picasso hoisting it; such a consumer would now need to
declare it themselves.