solidjs / solidjs/solid-start

Use `clientOnly` without isolating component in its own file

Open
#1,929 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
TypeScript
Stars
5.9k
Forks
426
Avg merge
1d 3h
Merged PRs (30d)
11

Description

What is this request related to?

Request

📋 Suggested

https://docs.solidjs.com/solid-start/reference/client/client-only

📋 General description or bullet points

Provide a way of using clientOnly without creating a separate file.
Code wise, this could be more ergonomic.

Could also create a helper function to directly translate component function to client only component.

import { clientOnly } from "@solidjs/start"

function ClientOnlyComponent() {
  const location = window.document.location
  return <div>{location.href}</div>
}

type ResolveClientComponent = (value: {
  default: Component
}) => void

export default clientOnly(
  () =>
    new Promise((resolve: ResolveClientComponent) => {
      resolve({ default: ClientOnlyComponent })
    }),
)
🖥️ Reproduction of code samples in StackBlitz

StackBlitz doesn't support solid-start

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the clientOnly reference at https://docs.solidjs.com/solid-start/reference/client/client-only and inspect the existing clientOnly entry point. Determine how an inline component or helper could be supported without a separate file, then verify that the documented usage works without StackBlitz. Done means the requested ergonomic form is defined and supported by the API.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.