Conversation
# Conflicts: # .eslintrc.js # src/types.ts
src/core/create-storage.ts
Outdated
| }) as Effect<State, void, any> // as Effect<State, void, Fail<Err>> | ||
|
|
||
| const removeFx = attach({ | ||
| mapParams: () => undefined as any, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Tried to fix this by adding remove method to adapter, and removeFx calls it, or, in case it is absent — set method with null. Not sure I like it or not. Tried on memory adapter, will add for other adapters later.
There was a problem hiding this comment.
After tests approach didn't work with storage adapter (localStorage/sessionStorage) though... Cannot think of a way to notify persisted stores about removing value from storage. Will try smth else.
# Conflicts: # .size-limit.js # src/broadcast/index.ts # src/core/index.ts # src/core/persist.ts # src/index.ts # src/local/index.ts # src/memory/index.ts # src/query/index.ts # src/session/index.ts # src/types.ts
# Conflicts: # tests/core-validate.test.ts
# Conflicts: # tests/broadcast.test.ts # tests/local.test.ts # tests/memory.test.ts # tests/query.test.ts # tests/session.test.ts
fixes #216
Changes since @yumauri contribution to the branch:
removeEffect which is settingundefinedto storage valueclearEffect because it has to affect all storage, but current API assumes that Effects can affect only a particular entry with provided keyget->getFxset->setFxremove->removeFx