Open beachstrider opened 1 year ago
I don't think you can make the hooks work like this in Hydrogen 1 since they are just React callbacks, but perhaps @lordofthecactus can give more information on this.
The cart is being reworked in Hydrogen 2 and I think it will be more flexible then.
As @frandiox mentioned, in Hydrogen v1 It is not possible at the moment to chain async calls with await. It is possible to do chaining by checking the useCart
status and keeping track of which calls have been made.
Yeah, I tried that way and it brought about useless complexity. Hope it will be supported on v2.
On Tue, Jan 17, 2023 at 3:02 AM Daniel Rios @.***> wrote:
As @frandiox https://github.com/frandiox mentioned, in Hydrogen v1 It is not possible at the moment to chain async calls with await. It is possible to do chaining by checking the useCart status and keeping track of which calls have been made.
— Reply to this email directly, view it on GitHub https://github.com/Shopify/hydrogen/issues/2420#issuecomment-1384396095, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALRTRRYNEDYOKCFPTI2TP7TWSWEMFANCNFSM6AAAAAATQWH6XE . You are receiving this because you authored the thread.Message ID: @.***>
Describe the bug There must be the way to trigger multiple hooks async.. but there don't seems to be.
To Reproduce await cartCreate({}); await linesAdd([...]); await discountCodesUpdate({...}); ...
Expected behaviour Multiple hooks need to be triggered asynchronously.