Skip to content

Conversation

@Rohit3523
Copy link
Contributor

@Rohit3523 Rohit3523 commented Dec 17, 2025

Proposed changes

The useUserPreferences hook expects both a key and a default value, but during the migration from react-native-mmkv-storage to react-native-mmkv, we forgot to add the default value for the accessibility setting. Because of this missing default value, the switch stopped working and did not reflect state changes.

Introduced in #6744

Issue(s)

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Standardized default behavior for mentions and room hashtags so prefixes ('@' / '#') are now disabled by default when no preference is set.
  • Bug Fixes

    • Restored consistent default for GIF autoplay so animated images start playing by default when no preference is set.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

Added explicit default values to several useUserPreferences calls: mentions/hashtags and accessibility preferences now default to false, while GIF autoplay defaults to true. No other logic or signature changes.

Changes

Cohort / File(s) Summary
Mention components
app/containers/markdown/components/mentions/AtMention.tsx
useUserPreferences(USER_MENTIONS_PREFERENCES_KEY, false) — added false default for mentionsWithAtSymbol.
Hashtag component
app/containers/markdown/components/mentions/Hashtag.tsx
useUserPreferences(ROOM_MENTIONS_PREFERENCES_KEY, false) — added false default for roomsWithHashTagSymbol.
Accessibility & appearance view
app/views/AccessibilityAndAppearanceView/index.tsx
Two useUserPreferences calls updated to pass false as the default for USER_MENTIONS_PREFERENCES_KEY and ROOM_MENTIONS_PREFERENCES_KEY.
Image viewer
app/containers/ImageViewer/ImageViewer.tsx
useUserPreferences(AUTOPLAY_GIFS_PREFERENCES_KEY, true) — added true default for autoplayGifs/isPlaying.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Uniform pattern change (adding default arg) across small number of files.
  • Pay attention to: AtMention.tsx, Hashtag.tsx, index.tsx (Accessibility view), and ImageViewer.tsx to confirm intended defaults and any UI implications.

Poem

🐰 I nibble defaults, small and bright,
false for tags, true for GIF delight,
a hop, a tweak, preferences set,
tiny changes — no regret! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding default values to useUserPreferences calls across multiple components to fix a regression.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch default-value-missing

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0693a7d and 1c9ec49.

📒 Files selected for processing (4)
  • app/containers/ImageViewer/ImageViewer.tsx (1 hunks)
  • app/containers/markdown/components/mentions/AtMention.tsx (1 hunks)
  • app/containers/markdown/components/mentions/Hashtag.tsx (1 hunks)
  • app/views/AccessibilityAndAppearanceView/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/containers/markdown/components/mentions/Hashtag.tsx
  • app/containers/markdown/components/mentions/AtMention.tsx
  • app/views/AccessibilityAndAppearanceView/index.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
app/containers/ImageViewer/ImageViewer.tsx (2)
app/lib/methods/userPreferences.ts (1)
  • useUserPreferences (63-90)
app/lib/constants/keys.ts (1)
  • AUTOPLAY_GIFS_PREFERENCES_KEY (21-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ESLint and Test / run-eslint-and-test
  • GitHub Check: format
🔇 Additional comments (1)
app/containers/ImageViewer/ImageViewer.tsx (1)

33-33: LGTM! Bugfix correctly adds missing default value.

The default value of true is appropriate for GIF autoplay in a messaging context, ensuring GIFs play automatically unless the user explicitly disables this preference.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@OtavioStasiak OtavioStasiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@OtavioStasiak OtavioStasiak merged commit 0c1f9ca into develop Dec 17, 2025
8 of 27 checks passed
@OtavioStasiak OtavioStasiak deleted the default-value-missing branch December 17, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants