TNG/ngqp

Expose a replayed value$ observable

Airblader opened this issue · 2 comments

What's your idea?
QueryParam and QueryParamGroup currently expose a valueChanges observable, akin to Angular Forms, which is backed by a Subject<>. This can create a problem as the first value may be "missed", see #72 and #176. While there is a relatively easy solution to this, it still creates unnecessary boilerplate and can be confusing.

Therefore, we should expose a value$ observable on both which is backed by a ReplaySubject<>(1). This makes it easier for users to connect ngqp to their logic.

As a side note, in the documentation we should prioritize & encourage the use of value$ and discourage that of valueChanges.

w5l commented

Moving users away from valueChanges implicitly means moving the project away from following the Angular Forms style. Using startsWith(...) fixes the issue and when needed in multiple locations, it can be moved into a wrapper class.