Skip to content

Conversation

@feruzm
Copy link
Member

@feruzm feruzm commented Jan 31, 2026

Summary by CodeRabbit

  • New Features

    • Search, drafts, bookmarks and notifications now use query-backed flows and new search hooks for more reliable results.
    • Notification timestamps added for clearer time context.
  • Bug Fixes

    • Prevented tiny layout jitter in comments and skipped metadata for very short posts.
    • Safer reblog list rendering and timestamp handling.
    • Added fail-safe to text-to-speech start to avoid stuck loading.
    • Improved notification load/pagination stability.
  • Performance Improvements

    • Reduced re-renders via memoization and more consistent caching.
  • Chores

    • Updated SDK dependency range.

coderabbitai[bot]

This comment was marked as resolved.

@ecency ecency deleted a comment from coderabbitai bot Feb 1, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Migrates many direct provider/RPC calls to React Query using @ecency/sdk query/mutation options, removes legacy provider functions, updates profile/token shapes, centralizes bookmark/favourite/notification flows into mutations, adds UI stability fixes (memoization, timeouts, tolerance checks), and adjusts data shapes across components and utilities.

Changes

Cohort / File(s) Summary
Dependency
package.json
Bumped @ecency/sdk version.
SDK surface & provider cleanup
src/providers/ecency/ecency.ts
Removed many legacy mobile endpoints; reduced provider surface to SDK-aligned functions.
Hive/dhive & auth migration
src/providers/hive/dhive.ts, src/providers/hive/auth.ts
Replaced direct RPC/provider calls with async QueryClient + SDK query options; adjusted profile parsing and unread-count retrieval.
Queries export & new search queries
src/providers/queries/index.ts, src/providers/queries/searchQueries.ts
Added searchQueries exports and several search-related hooks/aliases.
Notification queries & mutations
src/providers/queries/notificationQueries.ts
Switched to SDK-backed infinite notifications query; added read mutation and extended hook return surface.
React Query conversions (fetchQuery)
multiple files: src/screens/..., src/components/..., src/utils/... (e.g., .../editHistoryScreen.tsx, .../editorContainer.tsx, .../searchModalContainer.tsx, .../assetDetails/..., .../transfer/..., .../migrationHelpers.ts)
Replaced many direct provider calls (search, drafts, comment history, bookmarks, received vesting, unread counts, etc.) with queryClient.fetchQuery(...) using @ecency/sdk option builders and added token decryption where required.
Mutations & UI callers
src/components/organisms/quickProfileModal/..., src/components/postOptionsModal/..., src/screens/application/hook/useInitApplication.tsx
Replaced inline promise-based favorites/bookmarks/mark-read calls with React Query mutations and updated caller flows to use mutation lifecycle callbacks.
Wallet & portfolio changes
src/utils/wallet.ts, src/providers/queries/walletQueries/walletQueries.ts, src/containers/transferContainer.ts, src/redux/actions/walletActions.ts
Removed fetchAssetsPortfolio and heavy portfolio helpers; assets query now uses getPortfolioQueryOptions + select transform; added targeted invalidations/refetching; removed a thunk.
Post & comments handling
src/providers/queries/postQueries/postQueries.ts, src/components/postComments/container/postComments.tsx
Added synthetic parent entries for cached comments to support cache injection; added height-diff tolerance to avoid jitter loops.
Component optimizations & fixes
src/components/postView/..., src/components/textToSpeech/ttsControls.tsx, src/screens/reblogs/...
Memoized PostReadingMetadata and added short-content guard; added TTS 5s start timeout and cleanup; improved reblog username/timestamp handling.
Notifications UI
src/components/notification/view/notificationView.tsx, src/components/notificationLine/...
Switched SectionList→FlatList, flattened data model, added momentum onEndReached guard, and timestamp formatting/style.
Profile & persisted shape changes
src/containers/profileContainer.tsx, src/containers/profileEditContainer.tsx, src/utils/persistAccountGenerator.ts, src/screens/wallet/screen/walletScreen.tsx
Switched read/write flows from about.* to profile.* and updated persisted account shape accordingly.
Misc UI & stability fixes
src/components/accountsBottomSheet/..., src/screens/application/..., src/screens/searchResult/..., src/screens/notification/..., src/screens/assetsSelect/...
Various refactors: queryClient usage, safe guards, keyExtractor fixes, loading guards, and import updates.
Utilities
src/utils/time.ts, src/utils/user.ts
Added formatNotificationTimestamp and made getName/getAvatar robust to alternate profile shapes.

Sequence Diagram(s)

sequenceDiagram
    participant UI as App UI
    participant QC as QueryClient (getQueryClient)
    participant SDK as `@ecency/sdk`
    participant API as Remote API

    UI->>QC: fetchQuery(getNotificationsUnreadCountQueryOptions(username, token))
    QC->>SDK: build/normalize request
    SDK->>API: HTTP request (notifications/unread)
    API-->>SDK: unread count response
    SDK-->>QC: normalized result
    QC-->>UI: resolved unread count
    UI->>UI: update badge/state
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Poem

🐇 I hopped through code and swapped the old for new,
Queries hum and tokens weave their through.
Mutations spring, timeouts guard the play,
Memoized hops keep re-renders at bay.
A rabbit cheers — migration done, hooray! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Cache invalidations and fixes' is vague and generic, using non-descriptive terms that fail to convey the specific changes made across numerous files and systems in the changeset. Consider using a more specific title that highlights the primary change, such as 'Migrate to SDK query options for notifications, bookmarks, and portfolio data' or 'Replace direct API calls with SDK-backed query client patterns'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 bugs

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.

coderabbitai[bot]

This comment was marked as resolved.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/containers/profileContainer.tsx (1)

318-344: ⚠️ Potential issue | 🔴 Critical

Add pinCode to destructuring in _fetchProfile method.
At line 319, pinCode is referenced (line 336) without being destructured from props, causing a ReferenceError for non-own profiles. Other methods in this component correctly destructure it.

🛠️ Suggested fix
-        const { currentAccount } = this.props;
+        const { currentAccount, pinCode } = this.props;
🧹 Nitpick comments (1)
src/components/organisms/quickProfileModal/children/quickProfileContent.tsx (1)

207-217: Consider removing the Alert on error to avoid duplicate notifications.

The mutation hooks (useAddFavouriteMutation and useDeleteFavouriteMutation) already dispatch a fail toast in their error callbacks. Showing an additional Alert.alert here results in users seeing both a toast and a modal alert for the same error.

If the detailed error message is valuable, consider either:

  1. Removing this Alert and relying on the mutation hook's toast, or
  2. Modifying the mutation hooks to not dispatch a toast on error, allowing components to handle error display with more context
Option 1: Remove the redundant Alert
       onError: (error: any) => {
         // Error toast is already dispatched by the mutation hook
         console.warn('Failed to perform favorite action', error);
         setIsLoading(false);
-        Alert.alert(
-          intl.formatMessage({
-            id: 'alert.fail',
-          }),
-          error.message || error.toString(),
-        );
       },

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