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

Deprecate restore($store) #571

Closed
sergeysova opened this issue Dec 1, 2021 · 0 comments
Closed

Deprecate restore($store) #571

sergeysova opened this issue Dec 1, 2021 · 0 comments
Assignees
Labels
core effector package RFC Request for Comments

Comments

@sergeysova
Copy link
Member

sergeysova commented Dec 1, 2021

Proposal

I know cases when restore is useful:

  • saving payload from event with default value
  • saving doneData from effect

But with store, looks like it is useless.

if (is.store(obj)) return obj

In the source code it do nothing. And by semantics I think it can confuse with the definition of derived stores:

const $a = createStore('')
const $b = $a.map(s => s.length)

const $c = restore($b, 5)
  1. What meaning of default value 5 here?
  2. restore implies I want to create store by shorthand (not derived store), and here I can add .on
  3. But in source code we do nothing
  4. In the new major version derived stores cannot be used as targets Deprecate derived units in target #563, so target: restore($b) should throw an error, what is semantically wrong, because restore creates a New store

Use case

I don't see any case with restore($store).

@sergeysova sergeysova added the RFC Request for Comments label Dec 1, 2021
@zerobias zerobias added the core effector package label Dec 2, 2021
@zerobias zerobias added this to the effector 22.2.0 milestone Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core effector package RFC Request for Comments
Projects
None yet
Development

No branches or pull requests

2 participants