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

Separate adapter effects #217

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Separate adapter effects #217

wants to merge 17 commits into from

Conversation

igorkamyshev
Copy link
Collaborator

@igorkamyshev igorkamyshev commented Aug 6, 2024

fixes #216

Changes since @yumauri contribution to the branch:

  • implement remove Effect which is setting undefined to storage value
  • get rid of clear Effect because it has to affect all storage, but current API assumes that Effects can affect only a particular entry with provided key
  • rename all Effects to emphasize that they are Effects
    • get -> getFx
    • set -> setFx
    • remove -> removeFx
  • add basic docs

@igorkamyshev igorkamyshev marked this pull request as ready for review August 6, 2024 12:48
}) as Effect<State, void, any> // as Effect<State, void, Fail<Err>>

const removeFx = attach({
mapParams: () => undefined as any,
Copy link
Owner

Choose a reason for hiding this comment

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

I'm afraid that using undefined as new storage value will break synchronization across different persisted entities... I thought about adding extra support from adapter, like, adding removeItem support for localStorage and sessionStorage

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.

createStorage API for complex cases that cannot be covered with persist
2 participants