Skip to content

Commit

Permalink
Temporarily disable optimistically setting fixer status
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Aug 29, 2024
1 parent a66ea68 commit ab98802
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions projects/plugins/protect/src/js/data/scan/use-fixers-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,8 @@ export default function useFixersMutation() {

return useMutation( {
mutationFn: ( threatIds: number[] ) => API.fixThreats( threatIds ),
onSuccess: ( data, threatIds ) => {
// Optimistically update the fixer status to 'in_progress' for the selected threats.
queryClient.setQueryData(
[ QUERY_FIXERS_KEY, ...threatIds ],
( currentFixers: { threats: [] } ) => ( {
...currentFixers,
threats: {
...currentFixers.threats,
...threatIds.reduce( ( acc, threatId ) => {
acc[ threatId ] = { status: 'in_progress' };
return acc;
}, {} ),
},
} )
);
onSuccess: () => {
// TESTING: Do NOT optimistically update the fixer status to 'in_progress' for the selected threats.
// Show a success notice.
showSuccessNotice(
__(
Expand Down

0 comments on commit ab98802

Please sign in to comment.