Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom transform functions for state persistence #45

Closed
wants to merge 0 commits into from

Conversation

VldMrgnn
Copy link
Collaborator

This PR introduces:

Custom Transform Functions: Allows users to define inbound and outbound state transformations during persistence.
Integration with Persistence Workflow: Ensures that state transformations are applied when saving to and loading from storage.
Error Handling for Transformers: Adds error handling for transform functions with fallback to identity transformations.

Copy link
Owner

@neurosnap neurosnap left a comment

Choose a reason for hiding this comment

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

Overall looks good! I have a couple of questions that I'd like to talk through.

store/persist.ts Outdated Show resolved Hide resolved
store/persist.ts Outdated Show resolved Hide resolved
Copy link
Owner

@neurosnap neurosnap left a comment

Choose a reason for hiding this comment

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

Thank you for your patience. I have a couple of requests and then this is good to merge. Thanks so much for your help!

store/persist.ts Outdated Show resolved Hide resolved
store/persist.ts Outdated Show resolved Hide resolved
deno.lock Outdated Show resolved Hide resolved
@VldMrgnn
Copy link
Collaborator Author

VldMrgnn commented Oct 2, 2024

I've simplified the API by removing the dynamic setters (setInTransformer and setOutTransformer) to address the feedback about API complexity. This version still maintains flexibility by allowing state transformations, without the need for dynamic changes after the initial creation.
If you think that further simplifications are necessary, I would be happy to refactor.

@VldMrgnn
Copy link
Collaborator Author

VldMrgnn commented Oct 2, 2024

I wanted to test the newly released version 0.13.3, but I accidentally closed and hard-reset this PR in the process. However, I've created a new, clean PR with the updated code and tests: #50.

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