PR #290: Server-Side History Filtering, Pagination & Client Hook Refactor for Steemit Wallet (Next.js)

in Steem Devyesterday

Hello community and fellow developers,

I'm continuing my daily contribution series to the Next.js version of the Steemit Wallet. PR #290 is now open and all tests are passing:
🔗 https://github.com/steemit/wallet/pull/290

This PR introduces a comprehensive overhaul of the history query pipeline—moving filtering, batching, and pagination logic to the server while simplifying client-side hooks. The result is faster loads, reduced bundle size, and more predictable data flow.

ChatGPT Image May 22, 2026, 02_27_49 PM.png
Architecture overview: Server handles op-type filtering, batching & cursor pagination - Thanks ChatGPT


🔧 Key Changes in PR #290

1. Server-Side Op-Type Filtering & Pagination (/api/query/history)

  • New ops parameter: Accepts comma-separated operation type filters (transfer, comment, vote, etc.) to reduce payload size at the source.
  • Batching with safeguards: Implements BATCH_SIZE and MAX_BATCHES constants to prevent runaway queries and ensure predictable resource usage.
  • Cursor-based pagination: Returns nextFrom and exhausted flags for efficient infinite scroll, replacing offset-based logic.
  • Redis fallbacks: Graceful degradation to Redis cache when primary history sources are unavailable, improving resilience during high load.

2. Client API & Hook Refactor

  • apiClient.getHistory updated: Now accepts ops, limit, and nextFrom params; returns normalized SteemHistoryItem[] with server-provided pagination metadata.
  • Hooks simplified:
    • use-batch-history.ts
    • use-rewards-history.ts
    • use-activity-history.ts
      All now consume pre-filtered, pre-normalized data—removing duplicate client-side filtering logic and reducing re-renders.
  • Deprecation notices: Legacy client-side filtering helpers marked @deprecated with migration notes.

3. New Constants & Utilities (src/lib/steem/history-ops.ts)

export const WALLET_OPS = ['transfer', 'transfer_to_vesting', 'withdraw_vesting', ...];
export const ACTIVITY_OPS = ['comment', 'vote', 'reblog', ...];
export const REWARD_OPS = ['author_reward', 'curation_reward', ...];
  • Centralized op-type definitions for consistent filtering across client/server.
  • Added normalizeHistoryItem() and cache-key helpers to standardize data shape.

4. DevTools Security & Test Coverage

  • Redux DevTools sanitizers: Extended to redact auth_key, posting_key, and other sensitive fields in history payloads—building on prior work in PR #282.
  • Comprehensive tests: Added unit tests for:
    • Server op-filtering logic
    • Cursor advancement edge cases
    • Redis fallback behavior
    • Hook integration with normalized data

5. UI Cleanup

  • Removed unused icons from recent-activity components.
  • Updated snapshot tests to reflect visual changes.

✅ Testing & Validation

  • [x] All unit/integration tests pass (Jest + React Testing Library)
  • [x] Server filtering validated against live Steem node responses
  • [x] Cursor pagination tested for edge cases (empty results, mid-stream filtering)
  • [x] Redis fallback simulated and verified
  • [x] Redux DevTools sanitization confirmed via manual inspection
  • [x] No visual regressions in activity/rewards tabs

📚 Part of an Ongoing Contribution Series

This PR builds on recent stability and security improvements:

Every contribution focuses on hardening the wallet's performance, security posture, and developer experience for the Steem ecosystem.


Support Secure Steem Development

If you value proactive engineering and performance optimizations for the STEEM ecosystem, please consider supporting my witness: blaze.apps

🗳️ Vote Here:
Vote for blaze.apps Witness


Sort:  
Loading...
Loading...