Skip to content

Conversation

@PellegrinoDurante
Copy link
Contributor

@PellegrinoDurante PellegrinoDurante commented Oct 7, 2025

This pull request updates how the dependencyKeys property works in the cache plugin, ensuring that both the result of the cached function and its arguments (fnArgs) are passed to the dependencyKeys function. This makes cache invalidation more flexible and accurate. The changes also add a corresponding test to verify this new behavior.

Improvements to cache plugin API:

  • Updated the logic in remapDependencyKeys and its usage so that the dependencyKeys function now receives both the result and the function arguments (fnArgs) as parameters, allowing for more context-aware cache key generation. (src/plugin.ts, [1] [2]
  • Clarified documentation in README.md to specify that dependencyKeys receives the result as the first argument and function arguments as the second argument.

Test coverage:

  • Added a new test to ensure that the dependencyKeys function receives the correct arguments (result and fnArgs), and that cache keys are registered appropriately. (src/index.test.ts, src/index.test.tsR155-R186)

Copilot AI review requested due to automatic review settings October 7, 2025 14:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the dependency keys handling functionality by allowing dependency key functions to access both the result and the function arguments. This enables more flexible cache invalidation strategies based on input parameters.

  • Added fnArgs parameter to the remapDependencyKeys function
  • Updated dependency key function calls to pass both result and function arguments
  • Added comprehensive test coverage for the new functionality
  • Updated documentation to reflect the new function signature

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/plugin.ts Modified to pass fnArgs to remapDependencyKeys and updated function signature
src/index.test.ts Added test case to verify fnArgs are correctly passed to dependency key functions
README.md Updated documentation to describe the new second argument (fnArgs) for dependency key functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@PellegrinoDurante PellegrinoDurante merged commit da37f50 into JointlyTech:main Oct 7, 2025
@PellegrinoDurante PellegrinoDurante deleted the feat/fn-args branch October 7, 2025 15:34
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