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

Initial State is always undefined #5

Open
BigAB opened this issue Oct 24, 2019 · 0 comments
Open

Initial State is always undefined #5

BigAB opened this issue Oct 24, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@BigAB
Copy link
Owner

BigAB commented Oct 24, 2019

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.

@BigAB BigAB added the bug Something isn't working label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant