Skip to content

fix: bugfixes & improvements#32

Merged
fratzinger merged 1 commit into
mainfrom
fix/bugfixes-improvements
Jun 1, 2026
Merged

fix: bugfixes & improvements#32
fratzinger merged 1 commit into
mainfrom
fix/bugfixes-improvements

Conversation

@fratzinger

Copy link
Copy Markdown
Member

This pull request introduces several improvements and new features to the caching and hook utilities, along with enhanced test coverage and error handling. The most significant changes are the addition of customizable and optional deep cloning for cache results, robust error handling for the onDelete hook, and improvements to cache key normalization and async cache compatibility. Below are the most important changes grouped by theme:

Cache Hook Enhancements:

  • Added a clone option to CacheOptions in cache.hook.ts, allowing users to control whether and how cached results are deep-cloned (using fast-copy by default, with options to disable or provide a custom function). This prevents accidental mutation of cached objects and improves flexibility. [1] [2] [3] [4]
  • Improved cache invalidation performance by using a Set for O(1) membership checks when invalidating cached entries by ID. [1] [2]
  • Added comprehensive tests for the cache hook, including async (Promise-based) cache compatibility, cloning behavior, and around hook usage.
  • Updated the clone utility in clone.ts to use fast-copy instead of JSON.stringify for deep cloning, supporting more data types and circular references. Added corresponding tests. [1] [2]

Cache Key Normalization:

  • Refactored stableStringify in cache-utils.ts to use a single canonicalization pass with sortQueryProperties, ensuring deterministic cache keys regardless of object property or array order. Added extensive tests for key normalization. [1] [2]

Hook Error Handling and Robustness:

  • Enhanced the onDelete hook to support an onError callback, allowing non-blocking related-service errors to be surfaced without unhandled rejections. Blocking mode now correctly propagates errors to the caller. Added tests for both behaviors. [1] [2] [3] [4]
  • Improved the disallow hook to treat an empty transport array as "block all" (fail closed), with corresponding tests. [1] [2]

Developer Tooling:

  • Added a new linting command to .claude/settings.json for easier code quality checks.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying feathers-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1ff8993
Status: ✅  Deploy successful!
Preview URL: https://3fb1943d.feathers-utils.pages.dev
Branch Preview URL: https://fix-bugfixes-improvements.feathers-utils.pages.dev

View logs

@fratzinger fratzinger merged commit 0fa7cfd into main Jun 1, 2026
9 checks passed
@fratzinger fratzinger deleted the fix/bugfixes-improvements branch June 1, 2026 09:29
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.

1 participant