I have a @wire that works well in most cases.
@track searchTerm = '';
@track searchType = 'All';
@track selectEvent = '' ;
@track registrations;
@wire(searchRegistrations, {searchTerm: '$searchTerm', searchType: '$searchType', selectEvent: '$selectEvent'})
loadRegistrations(result) {
console.log("loadRegist at work");
this.registrations = result;
}
}
Changing searchTerm, searchType, selectEvent work as expected.
When changing searchType via a Button on the screen it brings up the resulting data by changing the '$searchTerm' wire parameter except if the key search fields use by the class is changed. The field is the assigned room. if we are
handleToggleClick() {
// retrieve the classList from the specific element
if (this.toggleIconName === 'utility:preview') {
this.toggleIconName = 'utility:hide';
this.toggleButtonLabel = 'View All Registrations';
this.searchType = "NoRoomAssign";
} else {
this.toggleIconName = 'utility:preview';
this.toggleButtonLabel = 'View not assigned Rooms ';
this.searchType = 'All';
}
}
I assign a room and save the record. Now if I click on the button and cause this.searchType = "NoRoomAssign";
If does not fire off the wire. I do not get the console.log in the loadRegistrations method.
Is this because the result is pulling from cache only even though the data is changed? How do I fix that?
Interesting blog about @wire but i'm unclear how to update the cache if that is what is needed. https://developer.salesforce.com/blogs/2019/09/caching-and-synchronizing-component-data-with-lightning-data-service.html