Skip to content

Deprecate restore($store) #571

@sergeysova

Description

@sergeysova

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).

Metadata

Metadata

Assignees

Labels

RFCRequest for Commentscoreeffector package

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions