Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBL-1344: Fix sort for backer dashboard by upgrading V1 query to GraphQL #2034

Merged

Conversation

amy-at-kickstarter
Copy link
Contributor

@amy-at-kickstarter amy-at-kickstarter commented Apr 11, 2024

📲 What

Upgrade the V1 API query on our backer dashboard page to GraphQL to fix its sort. This uses a similar GraphQL query to what we use on the web - querying the me object to get backed and saved projects.

🤔 Why

Late pledges were being shown based on the project end date, instead of by what was most recently backed. This special sort is only available on me { backedProjects }.

👀 See

Before:
Screenshot 2024-04-11 at 11 50 17 AM

After:
Screenshot 2024-04-11 at 11 44 57 AM

Compare with what I see on web:
Screenshot 2024-04-11 at 11 52 21 AM

On production, I see no difference between before-and-after; I think the effect is much more dramatic on staging because of our dubious data there.

@@ -1,8 +1,21 @@
import Foundation

public enum ProfileProjectsType: Decodable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this here so it could be part of the envelope.

return SignalProducer(value: envelope)
}

static func fetchProjectsEnvelope(from data: GraphAPI.FetchMySavedProjectsQuery.Data)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically the same as above but shaped slightly differently for the different response.

@@ -0,0 +1,17 @@
query FetchMyBackedProjects($first: Int = null, $after: String = null, $withStoredCards: Boolean = false) {
me {
backingsCount
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n.B. that this one uses backingsCount on me whereas the other query uses totalCount on pageInfo. totalCount for whatever reason is deprecated here.

@amy-at-kickstarter amy-at-kickstarter self-assigned this Apr 11, 2024
@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review April 11, 2024 15:54
@amy-at-kickstarter amy-at-kickstarter changed the title MBL: Fix sort for backer dashboard by upgrading V1 query to GraphQL MBL-1344: Fix sort for backer dashboard by upgrading V1 query to GraphQL Apr 11, 2024
@nativeksr
Copy link
Collaborator

nativeksr commented Apr 11, 2024

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

Copy link
Contributor

@ifosli ifosli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

/*
This is a very large response object, so load it from a file instead of putting it inline here.
These are very large response object, so load it from a file instead of putting it inline here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: object should be objects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, will fix

@amy-at-kickstarter amy-at-kickstarter merged commit 21dd603 into main Apr 11, 2024
5 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the feat/adyer/MBL-1344/sort-backed-projects-better branch April 11, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants