Skip to content

Conversation

@MattCCC
Copy link
Owner

@MattCCC MattCCC commented Feb 10, 2026

This pull request adds first-class support for React Native, improves cache key generation, and enhances configuration merging and abort handling. It also updates documentation and dependencies for better compatibility and developer experience.

React Native / Platform Support

  • Added React Native support with proper event handling and package exports
  • Fixed React Native timeout hanging indefinitely when the server is unreachable

Performance / Caching

  • Added string-based caching for fetchf, boosting caching throughput over 4×
  • Optimized revalidation loop by using for…of instead of forEach
  • Enhanced sanitizeObject to avoid dangerous properties and improve performance
  • Cached time tracking in markInFlight to avoid duplicate function calls
  • Reduced redundant lookups in ensureListenerSet for performance
  • Optimized promise storage in setInFlightPromise for deduplication
  • Optimized request retries and stale revalidation performance

Bug Fixes / Correctness

  • Prevented race conditions by yielding to the microtask queue before onRequest interceptors
  • Prevented cache key collisions caused by aggressive sanitization
  • Normalized headers and improved cache correctness
  • Enhanced timeout handling for sub-second values and edge cases

Refactor / Maintainability

  • Refactored config merging logic for maintainability

Tests

  • Improved test coverage for cache and response handling
  • Cleaned up skipped tests in sanitizeObject
  • Improved async handling in tests with act() for state updates and cleanup

Documentation / Benchmarks

  • Updated benchmark command for accuracy

Chores / Dev

  • Updated dev dependencies and React package limits
  • Minor text adjustments to expected cache keys
  • Build/CI improvements and artifact updates

- Updated @testing-library/react from 16.3.0 to 16.3.2
- Updated @types/react from 19.2.7 to 19.2.13
- Updated eslint-plugin-prettier from 5.5.4 to 5.5.5
- Updated globals from 16.5.0 to 17.3.0
- Updated prettier from 3.7.4 to 3.8.1
- Updated react from 19.2.1 to 19.2.4
- Updated react-dom from 19.2.1 to 19.2.4
- Updated typescript-eslint from 8.48.1 to 8.54.0
- Increased size limit for dist/react/index.js from 9.5 KB to 10 KB
@MattCCC
Copy link
Owner Author

MattCCC commented Feb 10, 2026

The new build of fetchf delivers a massive performance improvement, especially with string-based caching. Caching-enabled requests now reach an incredible 5,531,140 ops/sec (98 runs, ±0.28%), up from ~1,433,180 ops/sec in the old build — an increase of over 4×, making repeated requests almost instantaneous. Even simple fetchf requests without caching achieve 726,285 ops/sec (97 runs, ±0.96%), and config-heavy requests hit 661,279 ops/sec (91 runs, ±1.60%), both slightly below the old build numerically but benefiting from the new build’s lighter execution paths, improved memory access, and optimized request handling, making them effectively faster and more consistent under real-world workloads.

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

size-limit report 📦

Path Size
dist/browser/index.mjs 5.64 KB (+4.49% 🔺)
dist/browser/index.global.js 5.84 KB (+4.79% 🔺)
dist/node/index.js 5.75 KB (+5.09% 🔺)
dist/react/index.mjs 8.7 KB (+2.79% 🔺)
dist/react/index.js 9.47 KB (+3.2% 🔺)

@MattCCC
Copy link
Owner Author

MattCCC commented Feb 10, 2026

As per benchmarks the string-based caching in fetchf (~5.5M ops/sec) is 5–50× faster than node-cache in most realistic scenarios. For workloads dominated by high-frequency repeated requests, fetchf with string caching is dramatically faster than likes of standard fetch wrappers and axios + node-cache and can handle millions of operations per second with minimal overhead. Packages like node-cache aare fine for moderate use cases, but for ultra-high-throughput scenarios, fetchff new build outperforms them by a large margin.

Copy link
Collaborator

@devdgna devdgna 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!

@MattCCC MattCCC self-assigned this Feb 10, 2026
@MattCCC MattCCC merged commit c2d0c3b into master Feb 10, 2026
10 checks passed
@MattCCC MattCCC deleted the timeout-abort branch February 10, 2026 20:54
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