Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Refactor SDK checkout error handling #709

Merged
merged 11 commits into from
May 27, 2020

Conversation

orzechdev
Copy link
Contributor

@orzechdev orzechdev commented May 12, 2020

I want to merge this change because it changes checkout error handling.
Additionally, to simplify sdk, I have changed names from CheckoutRepositoryManager to LocalStorageManager and from NetworkManager to ApolloClientManager.

Screenshots

Pull Request Checklist

  1. All visible strings are translated with proper context.
  2. All data-formatting is locale-aware (dates, numbers, and so on).
  3. The changes are tested.
  4. The code is documented (docstrings, project documentation).
  5. Changes are mentioned in the changelog.

@netlify
Copy link

netlify bot commented May 12, 2020

Deploy preview for saleor-storefront-stage processing.

Building with commit 6a65b66

https://app.netlify.com/sites/saleor-storefront-stage/deploys/5ece620d6df87f0006a9bd06

@orzechdev orzechdev added blocked Blocked e.g. by API or some other issue. wip Work in progress labels May 12, 2020
@orzechdev orzechdev force-pushed the refactor/sdk-error-handling branch from d66f4f7 to 0e33cd0 Compare May 13, 2020 10:18
@orzechdev orzechdev removed the blocked Blocked e.g. by API or some other issue. label May 13, 2020
@orzechdev orzechdev changed the title Refactor SDK error handling Refactor SDK checkout error handling May 13, 2020
@orzechdev orzechdev marked this pull request as ready for review May 13, 2020 15:55
@orzechdev orzechdev removed the wip Work in progress label May 14, 2020
src/@sdk/jobs/Checkout/CheckoutJobs.ts Outdated Show resolved Hide resolved
src/@sdk/state/index.ts Outdated Show resolved Hide resolved
src/@sdk/data/ApolloClientManager/index.ts Outdated Show resolved Hide resolved
src/@sdk/mutations/checkout.ts Outdated Show resolved Hide resolved
Copy link
Member

@krzysztofwolski krzysztofwolski left a comment

Choose a reason for hiding this comment

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

Besides one comment LGTM

src/@sdk/api/index.ts Show resolved Hide resolved
Copy link
Member

@krzysztofwolski krzysztofwolski left a comment

Choose a reason for hiding this comment

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

LGTM.

@dominik-zeglen please confirm if requested changes are fine

// setPromoCode?: boolean;
// };
// }
export type IJobsModel = Record<string, Record<string, boolean>>;
Copy link
Contributor

@dominik-zeglen dominik-zeglen May 25, 2020

Choose a reason for hiding this comment

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

Why untyping it?
I wonder if it wouldn't be better (it'll be certainly easier) if we'd drop one level of nesting, simplifying this type to Record<"setCartItem" | "setPromoCode", boolean>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it might be typed, but it is not easy thing to do for me as it is not simple typing - I wrote string, because I didn't want to always redefine this type to be consistent with available methods in job classes.
And I'm not sure if dropping one level would good idea, because, what if we will have the same method name in two different job classes?

@dominik-zeglen dominik-zeglen merged commit 9c47831 into master May 27, 2020
@dominik-zeglen dominik-zeglen deleted the refactor/sdk-error-handling branch May 27, 2020 13:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants