Skip to content

Commit

Permalink
Merge pull request #14387 from artsy/joeyAghion/follows
Browse files Browse the repository at this point in the history
fix: skip queries for artworks by followed artists when logged out
  • Loading branch information
mzikherman authored Aug 23, 2024
2 parents d0b5bd4 + d0aa092 commit 633a713
Show file tree
Hide file tree
Showing 15 changed files with 602 additions and 1,670 deletions.
10 changes: 7 additions & 3 deletions src/Apps/Auction/AuctionApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,21 @@ export const AuctionAppFragmentContainer = createFragmentContainer(AuctionApp, {
@argumentDefinitions(
input: { type: "FilterArtworksInput" }
saleID: { type: "String!" }
isLoggedIn: { type: "Boolean!" }
) {
...AuctionArtworkFilter_viewer @arguments(input: $input, saleID: $saleID)
...AuctionWorksByFollowedArtistsRail_viewer @arguments(saleID: $saleID)
...AuctionArtworkFilter_viewer
@arguments(input: $input, saleID: $saleID, isLoggedIn: $isLoggedIn)
...AuctionWorksByFollowedArtistsRail_viewer
@arguments(saleID: $saleID)
@include(if: $isLoggedIn)
...AuctionCurrentAuctionsRail_viewer
showFollowedArtistsTab: saleArtworksConnection(
first: 1
aggregations: [TOTAL]
saleSlug: $saleID
includeArtworksByFollowedArtists: true
) {
) @include(if: $isLoggedIn) {
edges {
node {
internalID
Expand Down
6 changes: 4 additions & 2 deletions src/Apps/Auction/Components/AuctionArtworkFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ export const AuctionArtworkFilterRefetchContainer = createRefetchContainer(
@argumentDefinitions(
input: { type: "FilterArtworksInput" }
saleID: { type: "String!" }
isLoggedIn: { type: "Boolean!" }
) {
...ArtworkFilter_viewer @arguments(input: $input)
sale(id: $saleID) {
featuredKeywords
}
sidebarAggregations: artworksConnection(input: $input, first: 1) {
counts {
counts @include(if: $isLoggedIn) {
followedArtists
}
aggregations {
Expand All @@ -104,10 +105,11 @@ export const AuctionArtworkFilterRefetchContainer = createRefetchContainer(
query AuctionArtworkFilterQuery(
$input: FilterArtworksInput
$saleID: String!
$isLoggedIn: Boolean!
) {
viewer {
...AuctionArtworkFilter_viewer
@arguments(input: $input, saleID: $saleID)
@arguments(input: $input, saleID: $saleID, isLoggedIn: $isLoggedIn)
}
}
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("AuctionArtworkFilter", () => {
query AuctionArtworkFilterTestQuery($input: FilterArtworksInput!) {
viewer {
...AuctionArtworkFilter_viewer
@arguments(input: $input, saleID: "test-sale")
@arguments(input: $input, saleID: "test-sale", isLoggedIn: false)
}
}
`,
Expand Down
3 changes: 2 additions & 1 deletion src/Apps/Auction/__tests__/AuctionApp.jest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ describe("AuctionApp", () => {
...AuctionApp_sale
}
viewer {
...AuctionApp_viewer @arguments(input: $input, saleID: $slug)
...AuctionApp_viewer
@arguments(input: $input, saleID: $slug, isLoggedIn: true)
}
}
`,
Expand Down
5 changes: 4 additions & 1 deletion src/Apps/Auction/auctionRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const auctionRoutes: RouteProps[] = [
query auctionRoutes_TopLevelQuery(
$input: FilterArtworksInput
$slug: String!
$isLoggedIn: Boolean!
) {
me {
...AuctionApp_me @arguments(saleID: $slug)
Expand All @@ -69,7 +70,8 @@ export const auctionRoutes: RouteProps[] = [
...AuctionApp_sale
}
viewer {
...AuctionApp_viewer @arguments(input: $input, saleID: $slug)
...AuctionApp_viewer
@arguments(input: $input, saleID: $slug, isLoggedIn: $isLoggedIn)
}
}
`,
Expand All @@ -88,6 +90,7 @@ export const auctionRoutes: RouteProps[] = [

const variables = {
slug: params.slug,
isLoggedIn: !!props.context.user,
input: {
...auctionFilterDefaults,
...initialFilterStateFromUrl,
Expand Down
85 changes: 0 additions & 85 deletions src/Apps/Auctions/Components/WorksByArtistsYouFollowRail.tsx

This file was deleted.

This file was deleted.

13 changes: 9 additions & 4 deletions src/__generated__/AuctionAppTestQuery.graphql.ts

Large diffs are not rendered by default.

Loading

0 comments on commit 633a713

Please sign in to comment.