add lightweight query to refetch social interractions on comment mutation completion
All checks were successful
Tests / Tests (pull_request) Successful in 16s

This commit is contained in:
Loewy 2025-05-16 17:31:58 -07:00
parent bdc3961e46
commit 8859ad8951
3 changed files with 236 additions and 0 deletions

View File

@ -4763,6 +4763,82 @@ export type GetVideoDetailsQuery = {
}; };
}; };
export type GetVideoSocialDetailsByIdQueryVariables = Exact<{
videoId: Scalars["Int"]["input"];
}>;
export type GetVideoSocialDetailsByIdQuery = {
__typename?: "Query";
getVideo: {
__typename?: "VideoGQL";
id: number;
name?: string | null;
owner?: {
__typename?: "UserGQL";
id: number;
firebaseUid?: string | null;
username: string;
profileImageUri?: string | null;
} | null;
tags: Array<{
__typename?: "VideoTag";
name: string;
tagClasses: Array<{ __typename?: "VideoTagClass"; name: string }>;
}>;
reactions: Array<{
__typename?: "ReactionGQL";
videoId: number;
reaction: ReactionEnum;
user: {
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
followers?: Array<{
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
}> | null;
};
}>;
comments: Array<{
__typename?: "CommentGQL";
id: number;
message: string;
user: {
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
followers?: Array<{
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
}> | null;
};
replies: Array<{
__typename?: "CommentGQL";
id: number;
message: string;
user: {
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
followers?: Array<{
__typename?: "UserGQL";
id: number;
username: string;
profileImageUri?: string | null;
}> | null;
};
}>;
}>;
};
};
export type GetVideosQueryVariables = Exact<{ export type GetVideosQueryVariables = Exact<{
videoIds: Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"]; videoIds: Array<Scalars["Int"]["input"]> | Scalars["Int"]["input"];
}>; }>;
@ -8823,6 +8899,114 @@ export type GetVideoDetailsQueryResult = Apollo.QueryResult<
GetVideoDetailsQuery, GetVideoDetailsQuery,
GetVideoDetailsQueryVariables GetVideoDetailsQueryVariables
>; >;
export const GetVideoSocialDetailsByIdDocument = gql`
query GetVideoSocialDetailsById($videoId: Int!) {
getVideo(videoId: $videoId) {
id
name
owner {
id
firebaseUid
username
profileImageUri
}
tags {
tagClasses {
name
}
name
}
reactions {
videoId
user {
...UserSocialsFields
}
reaction
}
comments {
id
message
user {
...UserSocialsFields
}
replies {
id
message
user {
...UserSocialsFields
}
}
}
}
}
${UserSocialsFieldsFragmentDoc}
`;
/**
* __useGetVideoSocialDetailsByIdQuery__
*
* To run a query within a React component, call `useGetVideoSocialDetailsByIdQuery` and pass it any options that fit your needs.
* When your component renders, `useGetVideoSocialDetailsByIdQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetVideoSocialDetailsByIdQuery({
* variables: {
* videoId: // value for 'videoId'
* },
* });
*/
export function useGetVideoSocialDetailsByIdQuery(
baseOptions: Apollo.QueryHookOptions<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>(GetVideoSocialDetailsByIdDocument, options);
}
export function useGetVideoSocialDetailsByIdLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>(GetVideoSocialDetailsByIdDocument, options);
}
export function useGetVideoSocialDetailsByIdSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>(GetVideoSocialDetailsByIdDocument, options);
}
export type GetVideoSocialDetailsByIdQueryHookResult = ReturnType<
typeof useGetVideoSocialDetailsByIdQuery
>;
export type GetVideoSocialDetailsByIdLazyQueryHookResult = ReturnType<
typeof useGetVideoSocialDetailsByIdLazyQuery
>;
export type GetVideoSocialDetailsByIdSuspenseQueryHookResult = ReturnType<
typeof useGetVideoSocialDetailsByIdSuspenseQuery
>;
export type GetVideoSocialDetailsByIdQueryResult = Apollo.QueryResult<
GetVideoSocialDetailsByIdQuery,
GetVideoSocialDetailsByIdQueryVariables
>;
export const GetVideosDocument = gql` export const GetVideosDocument = gql`
query GetVideos($videoIds: [Int!]!) { query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) { getVideos(videoIds: $videoIds) {

View File

@ -14,6 +14,7 @@ query GetFeed(
} }
} }
} }
fragment UserSocialsFields on UserGQL { fragment UserSocialsFields on UserGQL {
id id
username username

View File

@ -82,6 +82,57 @@ query GetVideoDetails($videoId: Int!) {
} }
} }
fragment UserSocialsFields on UserGQL {
id
username
profileImageUri
followers {
id
username
profileImageUri
}
}
query GetVideoSocialDetailsById($videoId: Int!) {
getVideo(videoId: $videoId) {
id
name
owner {
id
firebaseUid
username
profileImageUri
}
tags {
tagClasses {
name
}
name
}
reactions {
videoId
user {
...UserSocialsFields
}
reaction
}
comments {
id
message
user {
...UserSocialsFields
}
replies {
id
message
user {
...UserSocialsFields
}
}
}
}
}
query GetVideos($videoIds: [Int!]!) { query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) { getVideos(videoIds: $videoIds) {
...VideoStreamMetadata ...VideoStreamMetadata