Skip to content

Context issues with solid-element #785

@Rkaede

Description

@Rkaede

I have 2 custom elements created with solid-element. One is a context provider and the other is a consumer.

<sld-component-a message="hello world"> // message gets added to a provider
  <sld-component-b></sld-component-b> // hello world gets rendered in here
</sld-component-a>

It works fine if the consuming element is a direct child of the provider. However, when the child is further down in the DOM the consumer will instead get the default value of the context instead.

<sld-component-a message="hello world">
  <div>
    <sld-component-b></sld-component-b> // renders the default context value instead of the updated value from the message
  </div>
</sld-component-a>

Working example:

https://stackblitz.com/edit/solid-vite-se4fzw?file=src/index.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions