Skip to content

Commit

Permalink
Feature: ListTable configuration (#7678)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaca authored Feb 3, 2025
1 parent 22bbb3b commit 74b417f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/DonationForms/V2/DonationFormsAdminPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion src/Views/Components/ListTable/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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;
Expand Down

0 comments on commit 74b417f

Please sign in to comment.