From 6d5cd9b1ed070c79fd9d55a9726ba5fa1a54bf0c Mon Sep 17 00:00:00 2001 From: Dean Wenstrand Date: Fri, 5 Jun 2026 14:27:42 -0700 Subject: [PATCH] Add lean GetLastSessionDate + GetShotClipRanges queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GetLastSessionDate: most-recent session startTime only, for the Home recency nudge (was pulling the full VideoCardFields payload). - GetShotClipRanges / ShotClipRange: per-shot frame/time window only, for the inline session player's condensed playback (was pulling ShotWithAllFeatures — features, serialized paths, annotations — x500). Co-Authored-By: Claude Opus 4.8 --- src/index.tsx | 235 +++++++++++++++++++++++++++++++++++++++ src/operations/feed.gql | 21 ++++ src/operations/shots.gql | 32 ++++++ 3 files changed, 288 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index b567b09..b5f3b7b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4377,6 +4377,24 @@ export type GetVideoFeedSessionCountQuery = { }; }; +export type GetLastSessionDateQueryVariables = Exact<{ + filters?: InputMaybe; + includePrivate?: InputMaybe; + feedInput?: InputMaybe; +}>; + +export type GetLastSessionDateQuery = { + __typename?: "Query"; + getFeedVideos: { + __typename?: "VideoHistoryGQL"; + videos: Array<{ + __typename?: "VideoGQL"; + id: number; + startTime?: any | null; + }>; + }; +}; + export type GetVideoFeedQueryVariables = Exact<{ limit?: Scalars["Int"]["input"]; after?: InputMaybe; @@ -5462,6 +5480,39 @@ export type GetShotsByIdsQuery = { }>; }; +export type ShotClipRangeFragment = { + __typename?: "ShotGQL"; + id: number; + videoId: number; + startFrame: number; + endFrame: number; + startTime: number; + endTime: number; +}; + +export type GetShotClipRangesQueryVariables = Exact<{ + filterInput: FilterInput; + shotsOrdering?: InputMaybe; + limit?: InputMaybe; +}>; + +export type GetShotClipRangesQuery = { + __typename?: "Query"; + getOrderedShots: { + __typename?: "GetShotsResult"; + count?: number | null; + shots: Array<{ + __typename?: "ShotGQL"; + id: number; + videoId: number; + startFrame: number; + endFrame: number; + startTime: number; + endTime: number; + }>; + }; +}; + export type ShotWithAllFeaturesFragment = { __typename?: "ShotGQL"; id: number; @@ -6988,6 +7039,16 @@ export const PlayerClusterFieldsFragmentDoc = gql` } ${PlayerClusterShotFieldsFragmentDoc} `; +export const ShotClipRangeFragmentDoc = gql` + fragment ShotClipRange on ShotGQL { + id + videoId + startFrame + endFrame + startTime @client + endTime @client + } +`; export const ShotWithAllFeaturesFragmentDoc = gql` fragment ShotWithAllFeatures on ShotGQL { id @@ -9072,6 +9133,93 @@ export type GetVideoFeedSessionCountQueryResult = Apollo.QueryResult< GetVideoFeedSessionCountQuery, GetVideoFeedSessionCountQueryVariables >; +export const GetLastSessionDateDocument = gql` + query GetLastSessionDate( + $filters: VideoFilterInput = null + $includePrivate: IncludePrivateEnum = MINE + $feedInput: VideoFeedInputGQL = null + ) { + getFeedVideos( + limit: 1 + filters: $filters + includePrivate: $includePrivate + feedInput: $feedInput + ) { + videos { + id + startTime + } + } + } +`; + +/** + * __useGetLastSessionDateQuery__ + * + * To run a query within a React component, call `useGetLastSessionDateQuery` and pass it any options that fit your needs. + * When your component renders, `useGetLastSessionDateQuery` 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 } = useGetLastSessionDateQuery({ + * variables: { + * filters: // value for 'filters' + * includePrivate: // value for 'includePrivate' + * feedInput: // value for 'feedInput' + * }, + * }); + */ +export function useGetLastSessionDateQuery( + baseOptions?: Apollo.QueryHookOptions< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >(GetLastSessionDateDocument, options); +} +export function useGetLastSessionDateLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >(GetLastSessionDateDocument, options); +} +export function useGetLastSessionDateSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables + >(GetLastSessionDateDocument, options); +} +export type GetLastSessionDateQueryHookResult = ReturnType< + typeof useGetLastSessionDateQuery +>; +export type GetLastSessionDateLazyQueryHookResult = ReturnType< + typeof useGetLastSessionDateLazyQuery +>; +export type GetLastSessionDateSuspenseQueryHookResult = ReturnType< + typeof useGetLastSessionDateSuspenseQuery +>; +export type GetLastSessionDateQueryResult = Apollo.QueryResult< + GetLastSessionDateQuery, + GetLastSessionDateQueryVariables +>; export const GetVideoFeedDocument = gql` query GetVideoFeed( $limit: Int! = 5 @@ -11375,6 +11523,93 @@ export type GetShotsByIdsQueryResult = Apollo.QueryResult< GetShotsByIdsQuery, GetShotsByIdsQueryVariables >; +export const GetShotClipRangesDocument = gql` + query GetShotClipRanges( + $filterInput: FilterInput! + $shotsOrdering: GetShotsOrdering + $limit: Int + ) { + getOrderedShots( + filterInput: $filterInput + shotsOrdering: $shotsOrdering + limit: $limit + ) { + count + shots { + ...ShotClipRange + } + } + } + ${ShotClipRangeFragmentDoc} +`; + +/** + * __useGetShotClipRangesQuery__ + * + * To run a query within a React component, call `useGetShotClipRangesQuery` and pass it any options that fit your needs. + * When your component renders, `useGetShotClipRangesQuery` 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 } = useGetShotClipRangesQuery({ + * variables: { + * filterInput: // value for 'filterInput' + * shotsOrdering: // value for 'shotsOrdering' + * limit: // value for 'limit' + * }, + * }); + */ +export function useGetShotClipRangesQuery( + baseOptions: Apollo.QueryHookOptions< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >(GetShotClipRangesDocument, options); +} +export function useGetShotClipRangesLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >(GetShotClipRangesDocument, options); +} +export function useGetShotClipRangesSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables + >(GetShotClipRangesDocument, options); +} +export type GetShotClipRangesQueryHookResult = ReturnType< + typeof useGetShotClipRangesQuery +>; +export type GetShotClipRangesLazyQueryHookResult = ReturnType< + typeof useGetShotClipRangesLazyQuery +>; +export type GetShotClipRangesSuspenseQueryHookResult = ReturnType< + typeof useGetShotClipRangesSuspenseQuery +>; +export type GetShotClipRangesQueryResult = Apollo.QueryResult< + GetShotClipRangesQuery, + GetShotClipRangesQueryVariables +>; export const EditShotDocument = gql` mutation EditShot($shotId: Int!, $fieldsToEdit: EditableShotFieldInputGQL!) { editShot(shotId: $shotId, fieldsToEdit: $fieldsToEdit) { diff --git a/src/operations/feed.gql b/src/operations/feed.gql index b85ffb9..ec831af 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -101,6 +101,27 @@ query GetVideoFeedSessionCount( } } +# Minimal query for the Home recency nudge ("you haven't recorded in N days"). +# Only the most recent session's start time — avoids pulling the full +# VideoCardFields payload (reactions, comments, player summaries, etc.). +query GetLastSessionDate( + $filters: VideoFilterInput = null + $includePrivate: IncludePrivateEnum = MINE + $feedInput: VideoFeedInputGQL = null +) { + getFeedVideos( + limit: 1 + filters: $filters + includePrivate: $includePrivate + feedInput: $feedInput + ) { + videos { + id + startTime + } + } +} + query GetVideoFeed( $limit: Int! = 5 $after: String = null diff --git a/src/operations/shots.gql b/src/operations/shots.gql index 93ae786..c4fa522 100644 --- a/src/operations/shots.gql +++ b/src/operations/shots.gql @@ -132,6 +132,38 @@ query GetShotsByIds($ids: [Int!]!) { } } +# Lightweight clip boundaries for condensed session playback. The inline +# session player only needs each shot's frame/time window to seek between +# shots — this skips the heavy ShotWithAllFeatures payload (cue/pocketing +# features, serialized shot paths, annotations, nested video/playlist). The +# startTime/endTime @client resolvers derive their values from the frame +# fields + the video (looked up internally), so this is all they require. +fragment ShotClipRange on ShotGQL { + id + videoId + startFrame + endFrame + startTime @client + endTime @client +} + +query GetShotClipRanges( + $filterInput: FilterInput! + $shotsOrdering: GetShotsOrdering + $limit: Int +) { + getOrderedShots( + filterInput: $filterInput + shotsOrdering: $shotsOrdering + limit: $limit + ) { + count + shots { + ...ShotClipRange + } + } +} + fragment ShotWithAllFeatures on ShotGQL { id videoId