You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
Make sure that "kinda fine" turns into "CI is green" first 😃
I said kinda because in my experiment (and example) the types are falling back to @types/react. I didn't see any type error but that was a very simple try.
I did meet some errors with /* @jsxImportSource solid-js */ though, maybe it was due to something else and is resolvable.
You mean "in Solid JSX features"? It could be patched via a dom-chef-based proxy file… maybe?
That's what I thought too, but it could become tedious. Or maybe this work:
Yes I think that's the right way. React is already aliased globally to dom-chef so it should't matter where you import @primer/octicons-react. At most you'll need
You know what has been killing me for years? That staleWhileRevalidate does not update the DOM after a new version has been fetched. If we have a way to have dynamic elements, I could create a (signal-based?) API that updates when the new value is fetched.
A hidden example for this would be the CSS hotfixes:
Inject cached CSS immediately to avoid FUOC
Update it when the update comes in (to avoid having to reload the page)
sync-pr-commit-title would be another feature that has "complex" dependencies and may benefit from better state management, but this requires further research so it's best not to start with this.
the PR commit title field depends on the PR title
the "will update" note depends on:
the PR title
the PR commit title
whether the user pressed "cancel"
There's no straightforward way to do this, we don't even depend on the PR title changing at the moment.
Instead of removing and recreating that button, we'd just have a dynamic component whose href and disable attributes are changed depending on the URL.
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";constCountingComponent=()=>{const[count,setCount]=createSignal(0);constinterval=setInterval(()=>{setCount((count)=>count+1);},1000);onCleanup(()=>clearInterval(interval));return<div>Count value is {count()}</div>;};functionadd(anchor){render(()=><CountingComponent/>,solidFragment(anchor));}functioninit(){observe(".some-class",add);}
If you can make the above work, we can figure out the icons later.
And then for download-folder-button the component would look like:
constDownloadFolderButton=()=>{const[url,setUrl]=createSignal(false);constinterval=setInterval(// Or a URL watcher()=>{setUrl(isRepoTree()&&!isRepoRoot()&&createDownloadUrl(location.href));},100);onCleanup(()=>clearInterval(interval));return(<ahidden={!url()}href={url()}>
Download
</a>);};
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:
they can be injected as native elements and even via JSX, e.g. .append(<my-active-component/>)
have native lifecycle events that deal with "activate on insertion" and "deactivate on page change"
they can be altered via attributes (which is probably less of an issue if the component is truly self-contained)
they accept any DOM element via slots: <my-active-component><XIcon/> Click me</my-active-component>
Activity
fregante commentedon Apr 10, 2023
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?
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.
kidonng commentedon Apr 10, 2023
I said kinda because in my experiment (and example) the types are falling back to
@types/react. I didn't see any type error but that was a very simple try.I did meet some errors with
/* @jsxImportSource solid-js */though, maybe it was due to something else and is resolvable.That's what I thought too, but it could become tedious. Or maybe this work:
Or something like that since it is a function and we have aliased
react.fregante commentedon Apr 10, 2023
Yes I think that's the right way.
Reactis already aliased globally todom-chefso it should't matter where you import@primer/octicons-react. At most you'll needbut I don’t think this is necessary. I just forget how these functions are handled here.
fregante commentedon Apr 10, 2023
So yeah, this would be welcome after:
kidonng commentedon Apr 11, 2023
This is enough to make icons work:
fregante commentedon Apr 14, 2023
You know what has been killing me for years? That
staleWhileRevalidatedoes not update the DOM after a new version has been fetched. If we have a way to have dynamic elements, I could create a (signal-based?) API that updates when the new value is fetched.A hidden example for this would be the CSS hotfixes:
Related:
cache.functionreturns fregante/webext-storage-cache#40fregante commentedon Apr 21, 2023
sync-pr-commit-titlewould be another feature that has "complex" dependencies and may benefit from better state management, but this requires further research so it's best not to start with this.There's no straightforward way to do this, we don't even depend on the PR title changing at the moment.
fregante commentedon Apr 26, 2023
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
hrefanddisableattributes are changed depending on the URL.Following the demo on their site, I think the correct setup for this would look like:
If you can make the above work, we can figure out the icons later.
And then for
download-folder-buttonthe component would look like:fregante commentedon May 25, 2023
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:
fregante commentedon Jun 1, 2023
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:
.append(<my-active-component/>)<my-active-component><XIcon/> Click me</my-active-component>