#How to nest components with client directives?

5 messages · Page 1 of 1 (latest)

midnight stag
#

Hey there,

I'm having troubles wrapping my head around why my components are mounted multiple times. I'm not sure if it's an Astro-issue or a Solidjs-one (or more likely, a programmer issue :P) .

I have a structure that looks similar to this:

<Layout> // Astro comp
  <Pagination client:load> // Solid comp <- onMount called once
    <Intro > // Astro comp
      <AnimatedIntroBackground client:load /> // Solid comp <- onMount called twice
    </Intro>
    ....
  </Pagination>
</Layout>

I use the Solid children()-helper to resolve children (in Pagination I measure the size of all children) .

Any clues or pointers?

midnight stag
#

Still haven't been able to figure this out. The duplicate Solid component isn't added to the DOM, but its script runs..

midnight stag
midnight stag
#

Ok, so further investigation shows it logs once per client-directive in the parent-children hierarchy..

midnight stag
#

How to nest components with client directives?