#bmizerany1234
1 messages ยท Page 1 of 1 (latest)
I clipped off:
Hmm, have it worked before? And are you just starting development with Stripe App?
It was working
Then I tried to reinvent html forms the way the docs said. Now I'm getting this.
Could you clarify exactly what changed?
I modified some JSX and then that happened. I made a handfull of changes and I'm not commiting to source control for every line I change so I'm not 100% sure
I can't get it to work anymore
Hi there ๐ taking over, as my colleague needs to step away
Are you able to revert to the previous state and instead make incremental changes to see what specifically broke it for you?
There is the little JSX I made that resulted in "corrupted" ext.js
not to be smug but: Can Stripe give me a decent error?
Is there a verbose mode lurking behind some hidden cli flag or something
I've began stepping back but still no luck
It works before this, not after: https://gist.github.com/bmizerany/2ed28b8ccd8b2e028225a4db2ed28b4a
Let me see if I can loop in someone with a bit more context than me. Just a minute
thank you
Thank you!
Okay so did you just get started, following one of our docs?
And in your backward stepping you have not reached a state where stripe apps start runs?
I mean yeah, but that was a month ago
I commented out the useState code and now it renders
but that is odd because now those are undefined and stripe is okay with that haha
When you say "now it renders" do you mean the app loads properly without the error displayed?
Sorry but we need to be very explicit about the exact behavior you are seeing
I mean that in the most literal sense:
In that the elements you are creating do not appear at all? No error, just nothing?
now if I uncomment any of those commented out lines, it will "reload" and render .. HOWEVER if I do nothing else and then restart the stripe apps whatever run then I get that nasty unhelpful error about being corrupt again
Do you mean running stripe apps start?
What happens if you remove the onChange logic from the Code text field?
I removed them all one-by-one and nothing happened but when I got ride of the useState stuff it all rendered
but obviously doesn't update state
And what is the full text of the error message logged to the console? Please copy/paste text rather than screenshot
The error message would be most helpful
I'm trying to help but screenshots and videos don't provide me the information I need.
Please copy/paste the text of the error message logged to the console
Thank you
np
Digging into this. What is the specific command you call to spin up your Stripe app?
stripe apps start
We're trying to replicate this issue
Thank you
So you are uncommenting the [code, setCode] line for useState, correct? Is that used anywhere elese besides the <TextField>?
Are you attempting to use the code const somewhere outside the component?
looking
There is no use of code outside or inside the component
This error happens when any of the useState things are uncommented
Ah, wait. useState needs to occur within a component
That is what is happening
Here is a useState that works in the same "component" / view / whatever React calls it
That works great
and it defined at the same level as the others that cause the error
Right, the only place where useState is valid in a Stripe App is within a component or another hook.
You can see an example of this here: https://github.com/stripe/stripe-apps/blob/main/examples/focus-view/src/views/App.tsx#L14
How is what I'm doing not in a component
oooooooh
wow
I see now
I'm almost out of heartburn medicine after all of this React
I find React hooks especially frustrating myself, so I get it
It would dope if one could just use a <form>
That would be ideal
It is so strange my other useState worked outside the "component"
oh it isn't
ha
sorry
But for now we just need to keep our useState and whatever other React weirdness within each App component.
For instance, in my app I have a Charge screen
const Charge = ({ userContext, environment }: ExtensionContextValue) => {
// Creating stateful variables for our Stripe data
const [charge, setCharge] = useState<Stripe.Charge>();
If I move that useState<Stripe.Charge>() call to above the const Charge line, I see the same error
Looks fine in the hot reload, but refresh the page and it's all broken