When you manually set the theme passed to DocsContainer and it changes after page load, the margin can suddenly change
It seems there's some styles that work based on what the theme "was" when the page loads, which breaks if you change the theme passed to DocsContainer.
I'm using what appears to be a private API to access the theme set by the toolbar theme switcher, but I think this is irrelevant to the bug – the bug is caused by the theme object being passed to DocsContainer changing.
Describe the bug
When you manually set the theme passed to DocsContainer and it changes after page load, the margin can suddenly change
It seems there's some styles that work based on what the theme "was" when the page loads, which breaks if you change the theme passed to DocsContainer.
https://github.com/storybookjs/storybook/assets/719814/81e3e658-aedb-4bd2-aa2d-a0df0371a30d
Reproduction link
https://stackblitz.com/edit/vitejs-vite-yow74x
Reproduction steps
npm run storybook
System
Additional context
I'm using what appears to be a private API to access the theme set by the toolbar theme switcher, but I think this is irrelevant to the bug – the bug is caused by the theme object being passed to DocsContainer changing.