bumbag-ui icon indicating copy to clipboard operation
bumbag-ui copied to clipboard

MultiSelect not working in next js when SSR

Open samthomson opened this issue 3 years ago • 1 comments

I get an error when I SSR a page containing the SelectMenu control (https://bumbag.style/form/select-menu/).

image

I am using Bumbag with Next JS. I integrated it as per the integrating with next js docs here: https://bumbag.style/getting-started/#usage-with-nextjs

If I comment out the select menu it works, so then I remove my comments and the app builds and I see the control on the page working as expected. Although if I refresh the page (SSR) I get the error.

All other controls work Ok. Do I need to change something to make the Select work specifically with SSR?

"bumbag": "^1.6.10",
"bumbag-server": "^1.5.1",
"next": "^10.0.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",

_app.tsx:

image

samthomson avatar Jan 03 '21 16:01 samthomson

I figured out a solution. I added regenerator-runtime as a dependency (yarn add regenerator-runtime) and then import it atop of my _app.tsx file:

import 'regenerator-runtime/runtime'

image

I'm not sure if this should be a dependency or worth adding as a step in the setting up with next-js docs. Or maybe next-js is at fault. Either way, works now.

samthomson avatar Jan 03 '21 20:01 samthomson