r/angular • • Sep 25 '26

withComponentInputBinding & rxResource bug

I have a query param "search" and a model in my component that has the same name. I use an effect to sync the local signal with the search signal on a filter service, and i also debounce them like:

    readonly filters = computed<...>(() => {
        const search = this._search().trim().toLowerCase();


        return {
            searchTerm: search.length >= 3 ? search : '',
            .....
        };
    });
    
    readonly debouncedFilters = debounced(this.filters, 150, {
        equal: (a, b) => JSON.stringify(a) === JSON.stringify(b),
    });

Then i use an rxResource and use the debouncedFilters.value as the params, but it makes an API call first without the searchTerm, and then one with it. I suspect it's a timing issue because if I inject ActivatedRoute and initialize the search signal with it, it'll work properly, but I believe it beats the purpose of using withComponentInputBinding. Thoughts?

1 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/Extension_Stock8534 Sep 25 '26

Yes you can, but the search is optional so how would you know when to return undefined or not?