hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

[BUG] Cannot dispatch event (resolve) for current cart state (uninitialized)

Open frandiox opened this issue 3 years ago • 5 comments

Reported on Discord by MagnusChase:

Clients are getting it quite a lot, I already fixed it one time (changed <Link> tags to <a href> because it was slow and broke the page load), but it starts to pop-up again. This error is visible after you return to a page that you have had opened (and not been on it) for quite a while

Also, does anyone have an idea what is that error? I tried to find the cause of it, but it looks like it occurs at page load (mostly product page)

As far as I've heard from the client, it only appears when you leave it open for a while and start using it again, hovewer bizzare it sounds


The errors could be related, and the "Something's wrong here" could be showing up just because another error is unrecoverable. It seems clear that at least there's a bug in Cart.client.tsx where the state of the cart goes back to uninitialized under certain conditions.

frandiox avatar Jul 01 '22 08:07 frandiox

We really should rebuild the cart cc @frehner

blittle avatar Jul 01 '22 14:07 blittle

Ugh, yeah, another situation where the cart gets into an impossible state ☹️

frehner avatar Jul 01 '22 15:07 frehner

Hey, clients on Safari (iOS and macOS) have been getting into another of those cart states (after clicking add to cart), I think it could be connected to this Zrzut ekranu 2022-07-11 o 17 35 26

magnuschase avatar Jul 12 '22 09:07 magnuschase

@lordofthecactus — I'm going to move up the cart rebuild in priority in our cycle goals, though still, this should follow #1773

benjaminsehl avatar Jul 13 '22 14:07 benjaminsehl

IMO the cart should be built with a minimal state machine. Doing so would make invalid states impossible. Something super small like: https://thisrobot.life/

blittle avatar Jul 13 '22 17:07 blittle