question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook - Accessing the body object off the request freezes things up

See original GitHub issue

I followed the recommended setup for storybook, and everything works great until I access data off of the request body. The code below is the main thing I’m trying to get working:

rest.post(`/messages`, (req, res, ctx) => {
    console.log("HERE ----->", Array.isArray(req.body.keys), req.body.keys)
    let response = {}
    //const { keys } = req.body

    //const keys = [...req.body.keys]

    //req.body.keys.forEach((key) => {
    //  response[key] = key.replaceAll(/\./gi, ' ')
    //})

    // for (let i = 0; i < req.body.keys.length; i++) {
    //   keys.push(req.body.keys[i])
    // }    // const response = keys.reduce((acc, current) => {
    //   acc[current] = current.replaceAll(/\./gi, ' ')    //   return acc
    // }, {})    
    return res(
      ctx.status(200),      
      ctx.json(response)
    )
  })

Any of the commented out code causes the response to hang, and not return. The window freezes and I have to force close it.

Node - 14.9.0 Storybook - 6.0.28 MSW - 0.21.3

I’m not sure what else might be needed, as I don’t see any errors in the console, in the terminal (storybook just shows everything is normal), and the network just hangs without the response coming back.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BryceHaydencommented, Dec 10, 2020

Sorry I’ve been a little MIA, it has been a busy week at work. I’ll try that first thing tomorrow and let you know what I see.

0reactions
kettanaitocommented, Feb 26, 2021

I’m closing this as I wasn’t able to reproduce the issue in an isolated context. Feel free to create a reproduction repository and post it here for us to look at. Until then the issue is simply non-reproducible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controls - Storybook - JS.ORG
Storybook Controls gives you a graphical UI to interact with a component's arguments dynamically without needing to code. It creates an addon panel...
Read more >
Tornado Survivor Stories - National Weather Service
This page offers stories submitted by tornado and hail storm survivors. These accounts have not been verified. If you survived a tornado or...
Read more >
Frozen food - Wikipedia
Freezing food slows decomposition by turning residual moisture into ice, inhibiting the growth of most bacterial species. In the food commodity industry, there ......
Read more >
Hypothermia - Symptoms and causes - Mayo Clinic
Learn about symptoms, treatment and prevention of hypothermia — a life-threatening condition in which the body loses heat faster than it can ...
Read more >
The Advocate | Baton Rouge, Louisiana Breaking New | The ...
The Advocate is Louisiana's leading news source, providing award-winning local and regional news coverage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found