dayhaysoos / use-shopping-cart

Shopping cart state and logic for Stripe
MIT License
907 stars 118 forks source link

console error when using handleCartClick #297

Closed CaioVinicius7 closed 1 year ago

CaioVinicius7 commented 1 year ago

Estou utilizando a o handleCartClickpara controlar se meu carrinho está aberto ou fechado, está tudo funcionando corretamente, porém quando clico nesse botão que chama o handleCartClickrecebo o seguinte erro no console: A non-serializable value was detected in an action, in the path: 'payload' `

How could I avoid this?

dayhaysoos commented 1 year ago

Hey @CaioVinicius7 , sorry but this is an error that gets thrown during SSR on Next.js. This actually isn't an issue at all, I need to find a way to hide this error.

dayhaysoos commented 1 year ago

Hey @CaioVinicius7, just closing this because I wasn't able to reproduce this error. Lemme know if I should re-open!

ericmillsio commented 1 year ago

I'm seeing this error in the same situation.

serializableStateInvariantMiddleware.ts:234 A non-serializable value was detected in an action, in the path: `payload`. Value: SyntheticBaseEvent {_reactName: 'onClick', _targetInst: null, type: 'click', nativeEvent: PointerEvent, target: path, …}altKey: falsebubbles: truebutton: 0buttons: 0cancelable: trueclientX: 1077clientY: 36ctrlKey: falsecurrentTarget: nulldefaultPrevented: falsedetail: 1eventPhase: 3getModifierState: ƒ modifierStateGetter(keyArg)isDefaultPrevented: ƒ functionThatReturnsFalse()isPropagationStopped: ƒ functionThatReturnsFalse()isTrusted: truemetaKey: falsemovementX: 0movementY: 0nativeEvent: PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}pageX: 1077pageY: 36relatedTarget: nullscreenX: -1203screenY: 38shiftKey: falsetarget: pathtimeStamp: 264682type: "click"view: Window {0: global, window: Window, self: Window, document: document, name: '', location: Location, …}_reactName: "onClick"_targetInst: null[[Prototype]]: Object 
Take a look at the logic that dispatched this action:  {type: 'cart/handleCartClick', payload: SyntheticBaseEvent} 
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants) 
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)

Doesn't cause any problems on my end though. It's occurring for me in normal usage of my app when the user clicks my cart icon, no SSR in my situation.