solid-start
solid-start copied to clipboard
Support mounting the same application multiple times
Solid-start apps currently boostrap through a side-effect of importing entry-client.HASH.js with script tag in the HTML:
<script type="module" async="" src="/assets/entry-client.e2045c51.js"></script>
This script module is a result of bundling the following code:
import { mount, StartClient } from "solid-start/entry-client";
mount(() => <StartClient />, document);
This setup means that we can only bootstrap the application once (because script type=module will ever evaluate the top level expressions and statements only once per document).
This breaks the cases where we'd like to bootstrap the same solid-start app multiple times within the same document.
We discussed this with @ryansolid and agreed to explore the following to support these use-cases:
- [ ] wrap the mount call into a function that is default-exported from the entry-client module
- [ ] consider moving the side-effect of calling the exported function into a script inlined in the HTML
- [ ] support disposing the application in some way (automatically or imperatively) and cleaning up all the registered listeners
Just a note that this fix also depends on https://github.com/solidjs/solid/issues/1325 which just got fixed in the Solid repo.
I wonder if this is still valid with all the changes Solid Start has gone through with using Nitro and Vinxi now