Add a new query to fetch the PLOT-related date in the Manage Pledge flow#2495
Conversation
amy-at-kickstarter
left a comment
There was a problem hiding this comment.
LGTM but requesting a small change in nullability!
| return SignalProducer(error: .couldNotParseJSON) | ||
| } | ||
|
|
||
| let envelope = ProjectPledgeOverTimeDataEnvelope( |
There was a problem hiding this comment.
It looks like GraphQL defines all of these as optional. These envelope values should be String? instead of String, so then you can get rid of these empty string placeholder values.
There was a problem hiding this comment.
I initially had them as optional but changed them to non-optional to align with the Project model. No big deal, can revert if needed.
There was a problem hiding this comment.
Mostly I'm always a bit suspicious of passing around empty placeholder strings! I find nil clearer.
There was a problem hiding this comment.
Great, I'll go ahead and make the change.
There was a problem hiding this comment.
Done! PLOT-related fields are now nullable both in ProjectPledgeOverTimeDataEnvelope and in the Project model.
There was a problem hiding this comment.
Follow-up ticket https://kickstarter.atlassian.net/browse/MBL-2578
| intentClientSecret: input.setupIntentClientSecret, | ||
| applePay: GraphAPI.ApplePayInput.from(input.applePay) | ||
| applePay: GraphAPI.ApplePayInput.from(input.applePay), | ||
| incremental: input.incremental |
There was a problem hiding this comment.
Adds the missing incremental field to ensure we can pass this value through the UpdateBacking mutation.
83100d2 to
fc8f47a
Compare
amy-at-kickstarter
left a comment
There was a problem hiding this comment.
Largely LGTM but I have a specific refactoring or follow-up request.
| return SignalProducer(value: project) | ||
| } | ||
|
|
||
| return fetchProjectPledgeOverTimeData(project: project) |
There was a problem hiding this comment.
If I'm understanding correctly, this will fire three requests in a row for PLOT projects: the first V1 request to fetch the project, then a second GraphQL request to fetch the rewards, and a third GraphQL request to fetch the PLOT data. Chaining together requests like this is ultimately going to lead to a much slower user experience, since it's three network round trips.
Since fetchProjectRewards is a GraphQL request already, could you fold the pledgeOverTime fragment into the second request?
I don't want to block this PR on this, so perhaps you can file a follow-up ticket for this issue. I assume PLOT pledges are a minority of pledges, but I do think this is worth fixing.
There was a problem hiding this comment.
That's a good call!!! I will go for it on Monday in a follow-up ticket!
📲 What
Adds a new GraphQL query called
FetchProjectPledgeOverTimeDatato fetch PLOT-related project information from the backend.🤔 Why
The Manage Pledge flow for PLOT-enabled projects requires certain project-level PLOT fields that are currently only available via GraphQL.
Since updating the existing V1 endpoint is not feasible at this time, this new query will allow us to fetch just the necessary PLOT fields while keeping the rest of the flow intact.
This query enables the function
fetchProjectPledgeOverTimeDatato retrieve the required information when editing PLOT-enabled pledges.🛠 How
FetchProjectPledgeOverTimeData👀 See
⏰ TODO