diff --git a/frontend/src/graphql/queries/ScenePairings.gql b/frontend/src/graphql/queries/ScenePairings.gql index c64049f50..7d8e52901 100644 --- a/frontend/src/graphql/queries/ScenePairings.gql +++ b/frontend/src/graphql/queries/ScenePairings.gql @@ -8,6 +8,7 @@ query ScenePairings( $per_page: Int! = 25 $direction: SortDirectionEnum! $sort: PerformerSortEnum! + $fetchScenes: Boolean! ) { queryPerformers( input: { @@ -34,7 +35,8 @@ query ScenePairings( images { ...ImageFragment } - scenes(input: { performed_with: $performerId }) { + scenes(input: { performed_with: $performerId }) + @include(if: $fetchScenes) { id title date diff --git a/frontend/src/graphql/types.ts b/frontend/src/graphql/types.ts index 7ee5afee7..bbaa57d3f 100644 --- a/frontend/src/graphql/types.ts +++ b/frontend/src/graphql/types.ts @@ -18022,6 +18022,7 @@ export type ScenePairingsQueryVariables = Exact<{ per_page?: Scalars["Int"]; direction: SortDirectionEnum; sort: PerformerSortEnum; + fetchScenes: Scalars["Boolean"]; }>; export type ScenePairingsQuery = { @@ -18046,7 +18047,7 @@ export type ScenePairingsQuery = { width: number; height: number; }>; - scenes: Array<{ + scenes?: Array<{ __typename: "Scene"; id: string; title?: string | null; diff --git a/frontend/src/pages/performers/components/scenePairings.tsx b/frontend/src/pages/performers/components/scenePairings.tsx index 0811fffb0..b07338d13 100644 --- a/frontend/src/pages/performers/components/scenePairings.tsx +++ b/frontend/src/pages/performers/components/scenePairings.tsx @@ -47,11 +47,13 @@ export const ScenePairings: FC = ({ id }) => { direction: { name: "dir", type: "string", default: SortDirectionEnum.ASC }, sort: { name: "sort", type: "string", default: PerformerSortEnum.NAME }, favorite: { name: "favorite", type: "string", default: "false" }, + scenes: { name: "scenes", type: "string", default: "false" }, }); const gender = resolveEnum(GenderFilterEnum, params.gender); const direction = ensureEnum(SortDirectionEnum, params.direction); const sort = ensureEnum(PerformerSortEnum, params.sort); const favorite = params.favorite === "true" || undefined; + const fetchScenes = params.scenes === "true"; const { page, setPage } = usePagination(); const { data, loading } = useScenePairings({ @@ -63,6 +65,7 @@ export const ScenePairings: FC = ({ id }) => { per_page: PER_PAGE, sort, direction, + fetchScenes, }); const performers = data?.queryPerformers.performers; @@ -125,13 +128,24 @@ export const ScenePairings: FC = ({ id }) => { setParams("favorite", e.currentTarget.checked.toString()) } /> + + + setParams("scenes", e.currentTarget.checked.toString()) + } + /> + ); @@ -146,23 +160,33 @@ export const ScenePairings: FC = ({ id }) => { loading={loading} listCount={data?.queryPerformers?.count} > - {performers?.map((p, i) => ( - - - - - - - {p.scenes.map((s) => ( - - - - ))} - - - {i < performers.length - 1 &&
} + {fetchScenes ? ( + performers?.map((p, i) => ( + + + + + + + {p?.scenes?.map((s) => ( + + + + ))} + + + {i < performers.length - 1 &&
} +
+ )) + ) : ( + + {performers?.map((p) => ( + + + + ))} - ))} + )} );