Skip to content

Commit

Permalink
Protect: remove unused usePolling argument from credentials query hook (
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller authored Oct 21, 2024
1 parent 8e6d300 commit 55c0319
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Fixed background refreshing of data when credentials modal opened.


20 changes: 1 addition & 19 deletions projects/plugins/protect/src/js/data/use-credentials-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ import { QUERY_CREDENTIALS_KEY } from '../constants';
/**
* Credentials Query Hook
*
* @param {object} args - Args.
* @param {boolean} args.usePolling - Use polling.
*
* @return {UseQueryResult} useQuery result.
*/
export default function useCredentialsQuery( {
usePolling,
}: { usePolling?: boolean } = {} ): UseQueryResult< [ Record< string, unknown > ] > {
export default function useCredentialsQuery(): UseQueryResult< [ Record< string, unknown > ] > {
const { isRegistered } = useConnection( {
autoTrigger: false,
from: 'protect',
Expand All @@ -25,19 +20,6 @@ export default function useCredentialsQuery( {
queryKey: [ QUERY_CREDENTIALS_KEY ],
queryFn: API.checkCredentials,
initialData: window?.jetpackProtectInitialState?.credentials,
refetchInterval: query => {
if ( ! usePolling ) {
return false;
}
if ( ! query.state.data ) {
return false;
}
if ( query.state.data?.length ) {
return false;
}

return 5_000;
},
enabled: isRegistered,
} );
}

0 comments on commit 55c0319

Please sign in to comment.