fix(EmojiPicker): drop @emoji-mart/react peer dependency - #3255
Conversation
@emoji-mart/react declares react as ^16.8 || ^17 || ^18, omitting React 19, so integrators on React 19 hit peer-dependency errors and have to add package.json overrides even though the package works fine there. Vendor its ~20-line wrapper around the emoji-mart Picker custom element instead (MIT, from missive/emoji-mart) and remove the dependency from peerDependencies, peerDependenciesMeta and devDependencies. emoji-mart and @emoji-mart/data remain optional peer dependencies. This also lets us drop the CJS default-unwrapping workaround from #3199, which existed because @emoji-mart/react ships CJS with the component on exports.default and broke under strict ESM interop. Not a breaking change: @emoji-mart/react was an optional peer dependency and nothing in the SDK imports it any more.
π WalkthroughWalkthroughChangesThe PR adds a local React Emoji picker integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: π₯ Pre-merge checks | β 5β Passed checks (5 passed)
β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: +154 B (+0.02%) Total Size: 884 kB π¦ View Changed
βΉοΈ View Unchanged
|
There was a problem hiding this comment.
π§Ή Nitpick comments (1)
src/plugins/Emojis/Picker.tsx (1)
28-29: π Maintainability & Code Quality | π΅ Trivial | β‘ Quick winDocument the ESLint exception.
Add a reason before the suppression. The effect must create the picker once. Prop changes use
instance.current.update(props).Proposed change
+ // Create the picker once. Prop changes use instance.current.update(props) above. // eslint-disable-next-line react-hooks/exhaustive-deps }, []);As per coding guidelines, βDo not suppress ESLint/Prettier rules broadly; justify and scope exceptions when necessary.β
π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/plugins/Emojis/Picker.tsx` around lines 28 - 29, Add a concise justification for the react-hooks/exhaustive-deps suppression next to the disable directive in the effect that creates the picker, stating that it intentionally runs once and subsequent prop changes are handled through instance.current.update(props).Source: Coding guidelines
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/plugins/Emojis/Picker.tsx`:
- Around line 28-29: Add a concise justification for the
react-hooks/exhaustive-deps suppression next to the disable directive in the
effect that creates the picker, stating that it intentionally runs once and
subsequent prop changes are handled through instance.current.update(props).
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 029e94ed-44e4-4386-ad63-81f110204be5
β Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
π Files selected for processing (4)
package.jsonsrc/plugins/Emojis/EmojiPicker.tsxsrc/plugins/Emojis/Picker.tsxsrc/plugins/Emojis/__tests__/Picker.test.tsx
π€ Files with no reviewable changes (1)
- package.json
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3255 +/- ##
==========================================
+ Coverage 85.18% 85.19% +0.01%
==========================================
Files 507 508 +1
Lines 15949 15958 +9
Branches 5025 5025
==========================================
+ Hits 13586 13596 +10
+ Misses 2363 2362 -1 β View full report in Codecov by Harness. π New features to boost your workflow:
|
π― Goal
@emoji-mart/reactdeclaresreactas^16.8 || ^17 || ^18in itspeerDependenciesβ React 19 is missing. Integrators on React 19 therefore hit peer-dependency resolution errors on install and have to addpackage.jsonoverrides to get past them, even though the package works fine on React 19 in practice.The wrapper that package provides is ~20 lines of glue around the
emoji-martPickercustom element. Rather than asking every React 19 integrator to carry an override, we vendor it and drop the dependency.π Implementation details
Vendored the wrapper - new
src/plugins/Emojis/Picker.tsx, taken from@emoji-mart/react(MIT, Copyright (c) Missive). Behaviour is identical to upstream;