How can I call @wire(getListUi) method on button click?

getListUi from lightning/uiListApi doesn't support imperative refresh or invocation in Spring 19. That wire adapter is in beta for the Spring 19 release (per https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.reference_lightning_ui_api_list_ui).

We're actively working on a feature whereby Lightning Data Service (and all of its @wire adapters) will automatically provision a new version of records when they're changed in any technology: LWC, Aura, Visualforce, Apex, triggers, etc. This means your components are reactive to record data changes regardless of the source. It also eliminates your need as a developer to know when to refresh which records. There's an open pilot for this; contact your account / support manager to join the Live Records pilot. We also have some other changes coming that'll make working with lists of records in LWC easier.

In the meantime you could replace your use of getListUi with Apex and SOQL, and use refreshApex from @salesforce/apex to imperatively refresh the Apex @wire adapter as required. See the code sample at https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.apex.


You can just imperatively call refreshApex as explained in the docs: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.apex

import { refreshApex } from '@salesforce/apex';
refreshApex(wiredProperty)

If the above method didn't work for you. Then you can call apex method imperatively

handleLoad() {
        getListUi({objectApiName: CONTENT_OBJECT, listViewId: '00B9A000001AitaUAC' })
            .then(result => {

            })
            .catch(error => {
                this.error = error;
            });
    }

https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.apex