Using Islands with third party components? #509
-
I've got Islands working using my own client components with signals, but using // WrappedPopover.tsx
export { Popover as default } from "solid-headless" // index.tsx
import { unstable_island } from 'solid-start'
const WrappedPopover = unstable_island(()=>import("./WrappedPopover"))
export default function App() {
return (
<div>
<WrappedPopover>
{/* other elements that were also exported */}
</WrappedPopover>
</div>
)
} Two outcomes occur. If I directly wrap the headless elements, then my entire page shows blank. But if I import a component inside of index.tsx which uses unstable islands to import, the page shows, but the component becomes static and has no reactivity. I've asked a similar question on the P.S. After messing with this some more today, I've noticed that when the UI appears and is not reactive, it continues to not work on |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Finally got it working. Turns out that I had imported a solid component as a non-default export which was from a Server component. I think in the Documentation repo here, they do export the Before:App.tsx
FeaturesDesktop.tsx
After:App.tsx
FeaturesDesktop.tsx
FeatureComponent.tsx
ExplanationPoor architecture, but whatever - App.tsx uses the Mobile Features component, and imports the Desktop Features Component as an island. Both Mobile and Desktop show the same FeatureComponent, but it is displayed differently. On Mobile, it is static, and on Desktop, it is reactive. I may have missed a few steps along the way, but this is the solution I have come up with and hopefully it helps others who get stuck in the same situation. |
Beta Was this translation helpful? Give feedback.
-
Yeah the provided API has a number of issues. Which is why it is still very much under review. The need for default is basically untenable for the final API. We still have some options to work through. |
Beta Was this translation helpful? Give feedback.
Finally got it working. Turns out that I had imported a solid component as a non-default export which was from a Server component. I think in the Documentation repo here, they do export the
<A>
component as default from solid-start, and have to import it into an island. So I ended up having to do the same thing.Before:
App.tsx
const FeaturesDesktop = unstable_island(()=>import("./FeaturesDesktop")
export function FeatureComponent(props) {
function FeaturesMobile() {
FeaturesDesktop.tsx
import { FeatureComponent } from './App'
After:
App.tsx
const FeaturesDesktop = unstable_island(()=>import("./FeaturesDesktop")
import FeatureComponent from './FeatureComponent'
function FeaturesMobil…