Skip to content

Initial State is always undefined #5

@BigAB

Description

@BigAB

Describe the bug
Despite this test passing, for the first render the state is always undefined.

To Reproduce
Steps to reproduce the behavior:

  1. import useEpic
  2. use it in a component with an Epic that returns an either a BehaviorSubject with initial state or an observable that pipes to startWith
  3. Rely on (or just log) that state on the component render

Expected behavior
The state should be available on the first render

Additional context
One solution would be to subscribe and unsubscribe immediately in first render to get the initial state. If that solution is used we should give a way to opt out, because that could cause weirdness with other peoples observables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions