fix: ensure discussions and resources sections update on actor change
Solves #1792
This commit is contained in:
@@ -4,6 +4,7 @@ import { useCurrentUserClient } from "./user";
|
||||
import type { Ref } from "vue";
|
||||
import { IGroup } from "@/types/actor";
|
||||
import { GROUP_DISCUSSIONS_LIST } from "@/graphql/discussion";
|
||||
import { useCurrentActorClient } from "./actor";
|
||||
|
||||
export function useGroupDiscussionsList(
|
||||
name: string | undefined | Ref<string | undefined>,
|
||||
@@ -13,6 +14,8 @@ export function useGroupDiscussionsList(
|
||||
}
|
||||
) {
|
||||
const { currentUser } = useCurrentUserClient();
|
||||
const { currentActor } = useCurrentActorClient();
|
||||
|
||||
const { result, error, loading, onResult, onError, refetch } = useQuery<
|
||||
{
|
||||
group: Pick<
|
||||
@@ -29,6 +32,12 @@ export function useGroupDiscussionsList(
|
||||
GROUP_DISCUSSIONS_LIST,
|
||||
() => ({
|
||||
name: unref(name),
|
||||
// To ensure the request is re-executed when the actor changes,
|
||||
// we include a dummy `_actor` parameter that's ignored by the server.
|
||||
// This function does not depend on the actor, the server identifies them by the token.
|
||||
// So without this dummy parameter, the GraphQL call is not automatically reloaded
|
||||
// when the actor changes.
|
||||
_actor: currentActor?.value?.id,
|
||||
...options,
|
||||
}),
|
||||
() => ({
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useCurrentUserClient } from "./user";
|
||||
import type { Ref } from "vue";
|
||||
import { IGroup } from "@/types/actor";
|
||||
import { GROUP_RESOURCES_LIST } from "@/graphql/resources";
|
||||
import { useCurrentActorClient } from "./actor";
|
||||
|
||||
export function useGroupResourcesList(
|
||||
name: string | undefined | Ref<string | undefined>,
|
||||
@@ -13,6 +14,8 @@ export function useGroupResourcesList(
|
||||
}
|
||||
) {
|
||||
const { currentUser } = useCurrentUserClient();
|
||||
const { currentActor } = useCurrentActorClient();
|
||||
|
||||
const { result, error, loading, onResult, onError, refetch } = useQuery<
|
||||
{
|
||||
group: Pick<
|
||||
@@ -29,6 +32,12 @@ export function useGroupResourcesList(
|
||||
GROUP_RESOURCES_LIST,
|
||||
() => ({
|
||||
name: unref(name),
|
||||
// To ensure the request is re-executed when the actor changes,
|
||||
// we include a dummy `_actor` parameter that's ignored by the server.
|
||||
// This function does not depend on the actor, the server identifies them by the token.
|
||||
// So without this dummy parameter, the GraphQL call is not automatically reloaded
|
||||
// when the actor changes.
|
||||
_actor: currentActor?.value?.id,
|
||||
...options,
|
||||
}),
|
||||
() => ({
|
||||
|
||||
Reference in New Issue
Block a user