Sandpack / nodebox-runtime

Nodebox is a runtime for executing Node.js modules in the browser.
https://sandpack.codesandbox.io/docs/advanced-usage/nodebox
Other
727 stars 41 forks source link

Nodebox doesn't send 'resize' event to Sandpack #54

Closed davidmccabe closed 11 months ago

davidmccabe commented 11 months ago

When Sandpack is used without Nodebox, the Sandpack bundler sends a 'resize' event during initialization. (https://github.com/codesandbox/sandpack-bundler/blob/ab9e6cb50be618f404e0f0e4886d2c51963790da/src/index.ts#L100)

It looks like this message doesn't get sent when using Sandpack with Nodebox.

Currently, the React docs integration relies on this message and hides its content until that message is sent. (https://github.com/reactjs/react.dev/blob/4f9e9a56611c7a56b9506cf0a7ca84ab409824bc/src/components/MDX/Sandpack/Preview.tsx#L153) This seems to be based on similar code in sandpack-react but takes it further in that it depends on resize being sent to show any content. I would guess that this avoids reflows when Sandpack is used in a documentation context.

What would it take to get Nodebox to send this message at the same point that sandpack-bundler does?