ngneat / elf

🧙‍♀️ A Reactive Store with Magical Powers

Home Page:https://ngneat.github.io/elf/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove withRequestCache, withRequestStatus, and DataSource

NetanelBasal opened this issue · comments

Which @ngneat/elf-* package(s) are relevant/releated to the feature request?

No response

Description

We'll remove these APIs in favor of the new simplified one:

const { state, config } = createState(withEntities<Todo>());

const store = new Store({ state, config, name: 'todos' });

const entities$ = store.pipe(
  selectAllEntities(),
  joinRequestResult(['todos'])
)

entities$.subscribe(result => {
  result.isLoading,
  result.isError,
  result.isSuccess.
  result.data // typed as Todo[]
  result.error
})

http.get('todos').pipe(
  tap((todos) => store.update(setEntities(todos))),
  trackRequestResult(['todos'])
)

Proposed solution

None

Alternatives considered

Request result API

Do you want to create a pull request?

Yes