diff --git a/src/DonationForms/V2/DonationFormsAdminPage.php b/src/DonationForms/V2/DonationFormsAdminPage.php index 166e0c70ce..1304ac4c4a 100644 --- a/src/DonationForms/V2/DonationFormsAdminPage.php +++ b/src/DonationForms/V2/DonationFormsAdminPage.php @@ -117,6 +117,9 @@ public function loadScripts() 'supportedAddons' => $this->getSupportedAddons(), 'supportedGateways' => $this->getSupportedGateways(), 'isOptionBasedFormEditorEnabled' => OptionBasedFormEditor::isEnabled(), + 'swrConfig' => [ + 'revalidateOnFocus' => false + ] ]; EnqueueScript::make('give-admin-donation-forms', 'assets/dist/js/give-admin-donation-forms.js') diff --git a/src/Views/Components/ListTable/api.ts b/src/Views/Components/ListTable/api.ts index 17f2fa3c60..ca9d6d3845 100644 --- a/src/Views/Components/ListTable/api.ts +++ b/src/Views/Components/ListTable/api.ts @@ -8,7 +8,7 @@ export default class ListTableApi { private readonly headers: {'X-WP-Nonce': string; 'Content-Type': string}; private readonly swrOptions; - constructor({apiNonce, apiRoot, preload = null}) { + constructor({apiNonce, apiRoot, preload = null, swrConfig = {}}) { this.controller = null; this.apiRoot = apiRoot; this.headers = { @@ -17,6 +17,7 @@ export default class ListTableApi { }; this.swrOptions = { use: [lagData], + ...swrConfig, onErrorRetry: (error, key, config, revalidate, {retryCount}) => { //don't retry if we cancelled the initial request if (error.name == 'AbortError') return;