File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { ActionForm } from '~shared/Fields/index.ts';
1515import { DecisionMethod } from '~types/actions.ts' ;
1616import { getDraftDecisionFromStore } from '~utils/decisions.ts' ;
1717import { formatText } from '~utils/intl.ts' ;
18+ import { isQueryActive } from '~utils/isQueryActive.ts' ;
1819import FormTextareaBase from '~v5/common/Fields/TextareaBase/FormTextareaBase.tsx' ;
1920import NotificationBanner from '~v5/shared/NotificationBanner/index.ts' ;
2021
@@ -222,9 +223,11 @@ const ActionSidebarContent: FC<ActionSidebarContentProps> = ({
222223 className = "flex h-full flex-col"
223224 innerRef = { formRef }
224225 onSuccess = { ( ) => {
225- client . refetchQueries ( {
226- include : [ SearchActionsDocument ] ,
227- } ) ;
226+ if ( isQueryActive ( 'SearchActions' ) ) {
227+ client . refetchQueries ( {
228+ include : [ SearchActionsDocument ] ,
229+ } ) ;
230+ }
228231 } }
229232 >
230233 < ActionSidebarFormContent
Original file line number Diff line number Diff line change 11import { apolloClient } from '~apollo' ;
22import { ColonyActionType , SearchActionsDocument } from '~gql' ;
33import { type MotionAction } from '~types/motions.ts' ;
4+ import { isQueryActive } from '~utils/isQueryActive.ts' ;
45import { updateContributorVerifiedStatus } from '~utils/members.ts' ;
56
67export const handleMotionFinalized = ( action : MotionAction ) => {
@@ -26,7 +27,9 @@ export const handleMotionFinalized = (action: MotionAction) => {
2627 break ;
2728 }
2829 case ColonyActionType . CreateDecisionMotion : {
29- apolloClient . refetchQueries ( { include : [ SearchActionsDocument ] } ) ;
30+ if ( isQueryActive ( 'SearchActions' ) ) {
31+ apolloClient . refetchQueries ( { include : [ SearchActionsDocument ] } ) ;
32+ }
3033
3134 break ;
3235 }
Original file line number Diff line number Diff line change 1+ import { apolloClient } from '~apollo' ;
2+
3+ export const isQueryActive = ( queryName : string ) => {
4+ const activeQueries = apolloClient . getObservableQueries ( ) ;
5+ return Array . from ( activeQueries . values ( ) ) . some ( ( query ) => {
6+ return query . queryName ?. includes ( queryName ) ;
7+ } ) ;
8+ } ;
You can’t perform that action at this time.
0 commit comments