Menu

A silent data-loss bug in a paid product: the draft was in memory the whole time
πŸ“°

A silent data-loss bug in a paid product: the draft was in memory the whole time

DEV Community: reactΒ·IanΒ·about 13 hours ago
#W4GUt0M2
#devtoreact#devto#dev#result#drafts
Reading 0:00
15s threshold

The bug had been live for weeks and no one had reported it, because it only fired for people who had just paid us money.

What the product does

It's a small tool that generates wedding speeches. Nine questions, three drafts, one payment. The kind of product where the whole value is the output β€” the text is the thing you buy.

The bug

After checkout, the payment provider redirects the user back to /success . That page verifies the payment and then does this:

< Link href = { `/${locale}/form` } > { copy . okCta } β†’ </ Link >

Enter fullscreen mode

Exit fullscreen mode

Back to the form. Makes sense β€” the drafts live on the form page.

Except the drafts were stored like this:

const [ result , setResult ] = useState ( null ) ; // ... setResult ( data ) ;

Enter fullscreen mode

Exit fullscreen mode

In memory.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.