Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
https://elderguide.com/tech/elderjs/
MIT License
2.11k stars 53 forks source link

Should not process sub hydrate-components when rendering a component #259

Open eight04 opened 2 years ago

eight04 commented 2 years ago

https://github.com/Elderjs/elderjs/blob/6d2cd150bcb7bf76aca3007190923916a00d4774/src/utils/svelteComponent.ts#L39

When rendering a component, sub hydrate-components are collected and added to the current page. Ideally, they should be processed after the entire HTML page is built. With the current code:

  1. The page may include a hydrated component which is actually not on the page. For example, when Layout.svelte doesn't output templateHtml.
  2. mountComponentsInHtml is applied to the same string multiple times.