New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A brief investigation of using SolidJS #6493
Comments
Same here, just yesterday I was annoyed at home a feature would benefit from this (I don't remember which)
Make sure that "kinda fine" turns into "CI is green" first 😃
You mean "in Solid JSX features"? It could be patched via a dom-chef-based proxy file… maybe? import React from 'dom-chef';
import {XIcon} from '@primer/octicons-react';
export () => <XIcon/>
Indeed, it would be good to find a feature that would benefit from this kind of interactivity and actually port it to Solid. Because in my last attempt I also got "90% there" and then had to abandon because that 10% was too much. |
I said kinda because in my experiment (and example) the types are falling back to I did meet some errors with
That's what I thought too, but it could become tedious. Or maybe this work: import {SomeIcon} from '@primer/octicons-react'
const element = <div>{SomeIcon()}</div> Or something like that since it is a function and we have aliased |
Yes I think that's the right way. import domChef from 'dom-chef'
import {SomeIcon} from '@primer/octicons-react'
const element = domChef.createElement(SomeIcon) but I don’t think this is necessary. I just forget how these functions are handled here. |
So yeah, this would be welcome after:
|
This is enough to make icons work: <SomeIcon {...SomeIcon.defaultProps}/> |
You know what has been killing me for years? That A hidden example for this would be the CSS hotfixes:
Related: |
There's no straightforward way to do this, we don't even depend on the PR title changing at the moment. |
If you manage to implement a minimal version, I think this could be the missing piece to Instead of removing and recreating that button, we'd just have a dynamic component whose Following the demo on their site, I think the correct setup for this would look like: import { render } from "solid-js/web";
import { onCleanup, createSignal } from "solid-js";
const CountingComponent = () => {
const [count, setCount] = createSignal(0);
const interval = setInterval(() => {
setCount((count) => count + 1);
}, 1000);
onCleanup(() => clearInterval(interval));
return <div>Count value is {count()}</div>;
};
function add(anchor) {
render(() => <CountingComponent />, solidFragment(anchor));
}
function init() {
observe(".some-class", add);
} If you can make the above work, we can figure out the icons later. And then for const DownloadFolderButton = () => {
const [url, setUrl] = createSignal(false);
const interval = setInterval(
// Or a URL watcher
() => {
setUrl(isRepoTree() && !isRepoRoot() && createDownloadUrl(location.href));
},
100
);
onCleanup(() => clearInterval(interval));
return (
<a hidden={!url()} href={url()}>
Download
</a>
);
}; |
This might be a better solution, depending on how it deals with raw DOM elements (e.g. dom-chef generated icons) https://github.com/vanjs-org/van Judging by the comments on HN, there’s no shortage of options: https://news.ycombinator.com/item?id=36067983 We just have to pick one that deals well with:
|
Closing for now. Feel free to send a minimal PR, but I think SolidJS might not be the right choice here. Anything using JSX is probably going to be problematic due to the icons. I think the ideal solution would be something based on Web Components because they're built specifically to be self-contained:
|
The use of UI frameworks has been discussed in #4058 and #5779 (comment). This has been on my mind for quite some time and just now I did some brief investigation.
Start from https://www.solidjs.com/guides/getting-started#buildless-options, get these modules first:
npm i solid-js npm i hyper-dom-expressions -D # For types
Then create a helper function:
Now we can author our features in Solid:
Pros:
Cons:
Haven't figured out how to use@primer/octicons-react
yetI'm sharing my thoughts here in case we do find a UI framework helpful.
The text was updated successfully, but these errors were encountered: