Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: issue with team members list not being up to date
Andrew Bastinb974bcc44233
diff --git a/packages/hoppscotch-app/components/teams/Edit.vue b/packages/hoppscotch-app/components/teams/Edit.vueindex 29ab56406..d50edee07 100644--- a/packages/hoppscotch-app/components/teams/Edit.vue+++ b/packages/hoppscotch-app/components/teams/Edit.vue@@ -242,7 +242,6 @@ watch(watch(() => props.editingTeamID,(teamID: string) => {- console.log("teamID", teamID)teamDetails.execute({ teamID })})@@ -252,6 +251,7 @@ const teamDetails = useGQLQuery<GetTeamQuery, GetTeamQueryVariables, "">({variables: {teamID: props.editingTeamID,},+ pollDuration: 10000,defer: true,updateSubs: computed(() => {if (props.editingTeamID) {@@ -282,6 +282,17 @@ const teamDetails = useGQLQuery<GetTeamQuery, GetTeamQueryVariables, "">({}),})+watch(+ () => props.show,+ (show) => {+ if (!show) {+ teamDetails.pause()+ } else {+ teamDetails.unpause()+ }+ }+)+const roleUpdates = ref<{userID: string@@ -294,8 +305,6 @@ watch(() => {if (teamDetails.loading) return- console.log(teamDetails)-const data = teamDetails.dataif (E.isRight(data)) {@@ -326,11 +335,6 @@ const updateMemberRole = (userID: string, role: TeamMemberRole) => {}}-watch(- () => teamDetails.data,- (newVal) => console.log(newVal)-)-const membersList = computed(() => {if (teamDetails.loading) return []diff --git a/packages/hoppscotch-app/helpers/backend/GQLClient.ts b/packages/hoppscotch-app/helpers/backend/GQLClient.tsindex 968d3b7fe..f98a105b0 100644--- a/packages/hoppscotch-app/helpers/backend/GQLClient.ts+++ b/packages/hoppscotch-app/helpers/backend/GQLClient.ts@@ -290,6 +290,9 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(const source: Ref<Source<OperationResult> | undefined> = ref()+ // A ref used to force re-execution of the query+ const updateTicker: Ref<boolean> = ref(true)+// Toggles between true and false to cause the polling operation to tickconst pollerTick: Ref<boolean> = ref(true)@@ -330,6 +333,10 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(// eslint-disable-next-line no-unused-expressionspollerTick.value+ // Just keep track of update ticking, but don't do anything+ // eslint-disable-next-line no-unused-expressions+ updateTicker.value+source.value = !isPaused.value? client.value.executeQuery<DocType, DocVarType>(request.value, {requestPolicy: "cache-and-network",@@ -416,12 +423,22 @@ export const useGQLQuery = <DocType, DocVarType, DocErrorType extends string>(}}+ updateTicker.value = !updateTicker.value+ }++ const pause = () => {+ isPaused.value = true+ }++ const unpause = () => {isPaused.value = false}const response = reactive({loading,data,+ pause,+ unpause,isStale,execute,})