Behaviour subject initial value null?

The purpose of BehaviorSubject is to provide initial value. It can be null or anything else. If no valid initial value can be provided (when user id isn’t known yet), it shouldn’t be used.

ReplaySubject(1) provides a similar behaviour (emits last value on subscription) but doesn’t have initial value until it is set with next.

It likely should be

private customer: Subject<Object> = new ReplaySubject<Object>(1);

Leave a Comment