Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated example documentation for CartProvider stripe prop #240

Closed
GGAlanSmithee opened this issue Sep 8, 2021 · 11 comments
Closed

Outdated example documentation for CartProvider stripe prop #240

GGAlanSmithee opened this issue Sep 8, 2021 · 11 comments

Comments

@GGAlanSmithee
Copy link

GGAlanSmithee commented Sep 8, 2021

EDIT see the first reply on this issue

As per the image, on SSR, there is a non-serializable value in the state.

image

If I understand it correctly, it is redux-persist that is the root of this message, but that's a bit weird, since it seems to me that you have properly configured to ignore these messages here

To my knowledge, I am not using this lib in any unconventional way;

image

As per the error message, it's the stripe prop, which is a promise, that is the offender. However, it seems to me that I am initiating the CartProvider very much the same way as in the example

Also, please not this only happens during SSR.

Thanks,

@GGAlanSmithee
Copy link
Author

Turned out there were more issues with this than just the SSR. Seems like the issue was the same as described here which is that the stripe prop expects a Stripe API key as a string, and not a stripe promise.

There seems to be some stale documentation regarding this, more specfically in the Gatsby example

I will change the title of this issue accordingly

@GGAlanSmithee GGAlanSmithee changed the title non serializable value in redux store on SSR Outdated example documentation for CartProvider stripe prop Sep 8, 2021
@dayhaysoos
Copy link
Owner

@GGAlanSmithee thank you for your feedback! I have a big workshop I'm presenting this week, once that's over with I can focus on addressing the issues you've raised. I really appreciate you!

@GGAlanSmithee
Copy link
Author

@dayhaysoos

Awesome - thank you too! Hope your workshop turns out well.

To add some additional info, it actually seems like the SSR related issue persists, even after applying the above-mentioned fix. Since the checkout seems to be successfull, I haven't looked into it further, but the message is as before:

image

Let me know if you need additional info.

@dayhaysoos
Copy link
Owner

Hey @GGAlanSmithee, this is an issue that's okay to ignore for now. Just to be sure, this is an issue on Next JS, right? This doesn't show up on Gatsby as far as I know. I thought I applied logic well enough for ignoring anything redux-persist related when it comes to SSR but apparently, it's not working. If you're curious here's the context:

https://github.com/dayhaysoos/use-shopping-cart/blob/master/use-shopping-cart/core/index.js#L58

I'm gonna have someone take a look at this soon, I've been trying to figure it out for a while

@GGAlanSmithee
Copy link
Author

@dayhaysoos

Thanks for your answer.

Yes, this is on next.js (haven't tested any other framework though).

Looking at the code you linked makes it even more weird. That conditional should def. return true in SSR (which I can confirm by debugging - typeof window === 'undefined').

PS. It doesn't seem like this warning appears in production, by running the app after statically generating it.

@dayhaysoos
Copy link
Owner

@GGAlanSmithee

I didn't know that this didn't show up for the production build, thanks for that!

Maybe my goal really should be just to hide the error. Not sure if Next has anything for that but I'm going to look into it

@alec-bfa
Copy link

alec-bfa commented Mar 3, 2023

Any updates on this? The error creates a lot of noise in local development.

@dayhaysoos
Copy link
Owner

Hey @alec-bfa, unfortunately, no... But lemme make some time this weekend to actually get to the bottom of this, I'll keep y'all updated.

@dayhaysoos
Copy link
Owner

Hey y'all, I think I know how to fix it now, I made an issue #308 to document it. I'm also having a hard time testing the library locally and I think I want to redo the monorepo set up real quick, it'll help me move forward in the long run. Just keeping y'all in the loop!

@dayhaysoos
Copy link
Owner

I finally figured out the issue, it's going to be addressed in this PR of me switching to pnpm (not related lol)

#310

@dayhaysoos
Copy link
Owner

Closing this as I think I've finally solved it, but waiting to confirm later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants