Next.js Discord

Discord Forum

Some style properties are missing when using dynamic import with ssr false

Unanswered
Cinnamon posted this in #help-forum
Open in Discord
CinnamonOP
This issue is so weird, I don't even know where to start so people could understand.

Basically I import all my components like in this example:

const vitali_atomicElements_Button = dynamic(() => import('ndcms-theme-vitali').then(mod => mod.Button), { ssr: false });


And then I have a component manager that loads them into page, based on data coming from CMS

The issue is as follows:

Some components are missing the padding prop, when using SSR:false

The data comes from CMS correctly and reaches the component, tried with console.log and I can also see the props in the React devtools

I even tried setting padding on the component manually and it does not appear

But what surprises me is, if I add some other new prop to the component, padding appears but that prop does not, all this is so weird I don't even know how to debug anymore

I am not using SSR because if I enable it, it says that require can't be used in page.ts, even if I do not, the import looks like the one above

Seems similar to

https://github.com/vercel/next.js/issues/33286

1 Reply

CinnamonOP
Apparently my issue was that I was also specifying marginLeft/Right/Top/Bottom, even if those were undefined, the normal padding prop was not working, wasn't displayed at all, weird is, if I had loaded that specific component with ssr true, it did load the padding prop, but lose it between page navigation