Skip to content

Support mounting the same application multiple times #388

@IgorMinar

Description

@IgorMinar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions