Skip to content

Conversation

@RYNBSD
Copy link

@RYNBSD RYNBSD commented Nov 18, 2025

  • Add transform method that allows functional updates to context values
  • Method takes a key and transformation function for immutable updates
  • Support complex data structures and object transformations
  • Maintain request isolation and work with default store values
  • Add TypeScript definitions for type-safe transformations
  • Include comprehensive test coverage for various use cases

Checklist

- Add `transform` method that allows functional updates to context values
- Method takes a key and transformation function for immutable updates
- Support complex data structures and object transformations
- Maintain request isolation and work with default store values
- Add TypeScript definitions for type-safe transformations
- Include comprehensive test coverage for various use cases
Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

I see it as a helper function to reduce the call of .get and .set.

But I don't see how it can be immutable updates.

@RYNBSD
Copy link
Author

RYNBSD commented Nov 18, 2025

transform is a helper that enables immutable updates when the passed fn returns a new value (object/array/primitive).

It does not itself deep-clone or prevent mutation of the old object — immutability is achieved by the user-supplied fn or by making fn operate on a copy/frozen value.

To make immutable updates safe by default, ensure:
Each request gets a cloned store (per-request isolation), and
Document/prefer fn implementations that return new objects (or optionally pass a copy/frozen value into fn).

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.

2 participants