function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sergio Mac IntoshSergio Mac Intosh 

LWC Wire Method on 1 Parameter

Hi All,

I have a Wired Method like this:
recordId = '';

@wire(searchUsers, {recordId: '$recordId', searchString: '$searchString'})

The method is working correctly, but the method is running everytime the recordId or the searchstring is changed. I would only like to run it when the searchstring is being changed & also not onload of the component. How can i manage this?

B KarthickeyanB Karthickeyan
searchUser({recordId: this.recordId, searchString:this.searchString}).then(result => {
            this.error = undefined;
            if(this.message !== undefined  ) {
               // Data returned from the apex method will be available here

        .catch(error => {
            this.message = undefined;
            this.error = error;
            // eslint-disable-next-line no-console
            console.log("error ", JSON.stringify(this.error));

Instead of using the wire method you can the method as mentioned below. you can write the following code inside the js Function.
Hope it helps you!