PR #290: Server-Side History Filtering, Pagination & Client Hook Refactor for Steemit Wallet (Next.js)
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.

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
opsparameter: Accepts comma-separated operation type filters (transfer,comment,vote, etc.) to reduce payload size at the source. - Batching with safeguards: Implements
BATCH_SIZEandMAX_BATCHESconstants to prevent runaway queries and ensure predictable resource usage. - Cursor-based pagination: Returns
nextFromandexhaustedflags 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.getHistoryupdated: Now acceptsops,limit, andnextFromparams; returns normalizedSteemHistoryItem[]with server-provided pagination metadata.- Hooks simplified:
use-batch-history.tsuse-rewards-history.tsuse-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
@deprecatedwith 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-activitycomponents. - 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:
- PR #285 Open: RPC Node Failover + Accessibility Fixes
- PR #282 Merged: Redux DevTools Credential Masking
- PR #274 Merged: SSR Redux Store Isolation Fixed
- Issue #275: Redux DevTools Exposure of Private Keys
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