Currently, I am following the conversion guide found here and I am attempting to convert the merge function used in a pipe according to this guide. However, after making the changes, it does not work as expected.
This is the code snippet I am using to explore the new merge functionality:
this.form.valueChanges.pipe(
startWith(1),
merge(this.form.statusChanges),
merge(this.click$),
map(() => this.form.value.query),
filter(() => this.form.valid)
)
.subscribe(this.search);
private search = (query: string) => {
this.tvs.search(query).subscribe(shows => this.shows = shows);
}
I have attempted to modify it like this:
merge(
this.form.valueChanges.pipe(
startWith(1),
map(() => this.form.value.query),
debounceTime(500),
tap(() => this.form.controls.query.errors && console.log(this.form.controls.query.errors)),
tap(() => this.form.status && console.log(this.form.status)),
filter(() => this.form.valid)
), this.form.statusChanges, this.click$)
.subscribe(this.search);
However, when I check the network tab in Chrome, the API call is made with the query value equal to the status of the form (VALID or INVALID). What would be the correct approach to handle this conversion?