Replies: 2 comments 1 reply
-
It is not currently possible to chain with awaits. But definitely in the radar. /** Specifies the input fields to create a merchandise line on a cart. */
export type CartLineInput = {
/** An array of key-value pairs that contains additional information about the merchandise line. */
attributes?: InputMaybe<Array<AttributeInput>>;
/** The identifier of the merchandise that the buyer intends to purchase. */
merchandiseId: Scalars['ID'];
/** The quantity of the merchandise. */
quantity?: InputMaybe<Scalars['Int']>;
/** The identifier of the selling plan that the merchandise is being purchased with. */
sellingPlanId?: InputMaybe<Scalars['ID']>;
}; If you absolutely need chaining calls to the cart, right now the best way is through waiting for state |
Beta Was this translation helpful? Give feedback.
1 reply
-
I created issue for this so closing discussion to avoid duplication: #685 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. I'm trying to execute multiple operations in a sequence using the
useCart
hook e.g.cartAttributesUpdate
andlinesRemove
.However, it seems only the first operation gets executed. I see there are completed callbacks on
CartProvider
but using these to figure out when another operation can be executed is not very convenient since it's separate from the code that interacts withuseCart
.I also tried a solution where I'm "sleeping" until
cart.status === "idle"
before calling another callback. This doesn't work either for some reason.I would expect these action callbacks in
useCart
to return a promise so that I can wait until they are resolved.Am I missing something or my use case is not supported by the library?
I can reproduce the error with following test:
Beta Was this translation helpful? Give feedback.
All reactions