Skip to content

Conversation

@feruzm
Copy link
Member

@feruzm feruzm commented Dec 27, 2025

What does this PR?

Where should the reviewer start?

Steps to reproduce

Issue number

Screenshots/Video

Summary by CodeRabbit

  • Refactor

    • State access centralized via new memoized selectors across the app.
  • Performance

    • Many UI components memoized and callbacks stabilized to reduce unnecessary re-renders.
    • Cache update handling improved to avoid redundant UI refreshes.
  • Dependencies

    • Package sources standardized to git+https and added reselect for selector memoization.

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

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@feruzm feruzm marked this pull request as draft December 27, 2025 18:25
@feruzm feruzm marked this pull request as ready for review December 27, 2025 18:25
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@feruzm feruzm marked this pull request as draft December 27, 2025 19:27
@feruzm feruzm marked this pull request as ready for review December 27, 2025 19:27
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@feruzm feruzm marked this pull request as draft December 27, 2025 19:44
@feruzm feruzm marked this pull request as ready for review December 27, 2025 19:45
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/containers/pointsContainer.ts (2)

260-260: Prefer the existing selectCurrentAccountName selector.

Line 260 calls selectCurrentAccount(state).name, which directly accesses a property after calling the selector. For consistency with the PR's goal and better null-safety, use the existing selectCurrentAccountName selector.

🔎 Proposed fix
+  selectCurrentAccountName,
  selectOtherAccounts,
  user: selectCurrentAccount(state),
- username: selectCurrentAccount(state).name,
+ username: selectCurrentAccountName(state),
  activeBottomTab: selectActiveBottomTab(state),

268-268: Consider creating a dedicated selector for the currency property.

Line 268 accesses selectCurrency(state).currency, which reaches into the returned object. For consistency with the selector pattern used elsewhere (e.g., selectCurrencyRate, selectCurrencySymbol), consider adding a dedicated selector in the selectors file that returns just the currency string.

src/screens/application/container/applicationContainer.tsx (1)

950-954: Incomplete selector migration for UI state.

Lines 950-954 still use direct state access. For consistency with the PR's goal and the rest of this file, consider:

  1. Line 952: activeBottomTab could use the existing selectActiveBottomTab selector (defined at line 272 of selectors file).
  2. Lines 951, 953, 954: toastNotification, isLogingOut, and rcOffer don't have corresponding selectors yet. Consider adding them to complete the migration.
🔎 Proposed fix for activeBottomTab

Add to imports at line 104:

  selectCurrentAccountUnreadActivityCount,
+ selectActiveBottomTab,
} from '../../../redux/selectors';

Update mapStateToProps:

  // UI
  toastNotification: state.ui.toastNotification,
- activeBottomTab: state.ui.activeBottomTab,
+ activeBottomTab: selectActiveBottomTab(state),
  isLogingOut: state.ui.isLogingOut,
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce40a8 and 318ac91.

📒 Files selected for processing (6)
  • src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.tsx
  • src/containers/pointsContainer.ts
  • src/containers/redeemContainer.tsx
  • src/redux/selectors/index.ts
  • src/screens/application/container/applicationContainer.tsx
  • src/screens/searchResult/screen/tabs/topics/container/topicsResultsContainer.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.tsx
  • src/containers/redeemContainer.tsx
  • src/screens/searchResult/screen/tabs/topics/container/topicsResultsContainer.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/containers/pointsContainer.ts (1)
src/redux/selectors/index.ts (8)
  • selectCurrentAccount (167-170)
  • selectActiveBottomTab (272-272)
  • selectIsConnected (77-80)
  • selectOtherAccounts (202-205)
  • selectPin (43-43)
  • selectIsPinCodeOpen (50-53)
  • selectGlobalProps (192-195)
  • selectCurrency (88-91)
⏰ 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: iOS Build
  • GitHub Check: Android Build
🔇 Additional comments (4)
src/redux/selectors/index.ts (3)

1-21: Excellent documentation.

The header comments clearly explain the purpose of memoized selectors and provide concrete migration examples. This will help developers understand and adopt the pattern consistently.


236-253: Factory selectors correctly implemented.

The factory selector pattern (returning a new selector on each call) is the correct approach for parameterized selections that need separate memoization per component instance. This enables proper memoization while supporting dynamic arguments.


22-272: Comprehensive and well-structured selector implementation.

The selector organization is clear (Application, Account, Cache, Posts, Communities, UI sections), and the implementation correctly uses createSelector for memoization. Safe defaults (e.g., || [], || null, || 0) prevent runtime errors from undefined values.

src/screens/application/container/applicationContainer.tsx (1)

929-948: Application and Account state successfully migrated to selectors.

The migration to selectors for Application and Account state is complete and correct. All props now derive from centralized, memoized selectors, which improves performance and maintainability.

@ecency ecency deleted a comment from coderabbitai bot Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants