Giter VIP home page Giter VIP logo

Comments (6)

lxsmnsyc avatar lxsmnsyc commented on July 26, 2024

I would have to say createUniqueId isn't the origin of the issue, it is where Toaster is used. Would be interesting to see how you are using the Toaster component and let's figure out how to solve it.

from terracotta.

aminya avatar aminya commented on July 26, 2024

After debugging this further, the issue seems to be that the Toaster is being used under a MyContext.Provider, which is created from a context.

Here is what the code looks like:

import { Toaster } from "solid-headless"
import { createContext } from "solid-js"

interface MyContextType {
    myMethod: () => void
}

const defaultMyContext = {
    myMethod: () => {
    }
}

const MyContext = createContext<MyContextType>(defaultMyContext);

export function MyToasterProvider(props) {
    const myMethod = () => {
        // doing things
    };

    return (<MyContext.Provider
        value={{
            myMethod
        }}
    >
        {props.children}
        <Toaster/>
    </MyContext.Provider>)
}

from terracotta.

lxsmnsyc avatar lxsmnsyc commented on July 26, 2024

I don't expect this to produce the issue either. Probably related to the siblings or the parent of MyToasterProvider

from terracotta.

markmals avatar markmals commented on July 26, 2024

I'm also seeing this error when trying to render a RadioGroup with Solid and Astro. When I change the directive on the Solid component from client:load to client:only the component works, meaning there is an issue with server-side rendering these components.

from terracotta.

lxsmnsyc avatar lxsmnsyc commented on July 26, 2024

I've experienced this myself so I think I've already found the exact issue as to why this happens.

image

Apparently Astro will mistakenly load SolidJS twice (due to Vite's module resolution) so it will think that solid-headless components were being rendered outside of a SolidJS root. I don't know how to fix this exactly, because I'm convinced that this is either an Astro issue or a Vite issue.

from terracotta.

lxsmnsyc avatar lxsmnsyc commented on July 26, 2024

I've created a relevant issue thread at Astro: withastro/astro#6709

I've still yet to reproduce this issue in SolidStart

from terracotta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.