Paul Armstrong
Paul Armstrong
SSolidJS
Created by flippyflops on 8/23/2024 in #support
Is there a way to enforce children of a particular component type?
From their examples:
import { createToken, resolveTokens } from "@solid-primitives/jsx-tokenizer";

function Tabs<T>(props: { children: (Tab: Component<{ value: T }>) => JSX.Element; active: T }) {
const Tab = createToken((props: { value: T }) => props.value);
// resolveTokens will look for tokens created by Tab component
const tokens = resolveTokens(Tab, () => props.children(Tab));
return (
<ul>
<For each={tokens()}>
{token => <li classList={{ active: token.data === props.active }}>{token.data}</li>}
</For>
</ul>
);
}

// usage
<Tabs active="tab1">
{Tab => (
<>
<Tab value="tab1" />
<Tab value="tab2" />
</>
)}
</Tabs>;
import { createToken, resolveTokens } from "@solid-primitives/jsx-tokenizer";

function Tabs<T>(props: { children: (Tab: Component<{ value: T }>) => JSX.Element; active: T }) {
const Tab = createToken((props: { value: T }) => props.value);
// resolveTokens will look for tokens created by Tab component
const tokens = resolveTokens(Tab, () => props.children(Tab));
return (
<ul>
<For each={tokens()}>
{token => <li classList={{ active: token.data === props.active }}>{token.data}</li>}
</For>
</ul>
);
}

// usage
<Tabs active="tab1">
{Tab => (
<>
<Tab value="tab1" />
<Tab value="tab2" />
</>
)}
</Tabs>;
10 replies
SSolidJS
Created by flippyflops on 8/23/2024 in #support
Is there a way to enforce children of a particular component type?
You could look at the jsx-tokenizer from solid-primitives. It doesn't exactly do what you're asking, but it might help enforce the pattern https://primitives.solidjs.community/package/jsx-tokenizer
10 replies
SSolidJS
Created by deluksic on 7/5/2024 in #support
Is there a way to prevent `lowercaseevent` names?
You could write a custom eslint plugin to do it… but you either have to know every single handler available or accept uniformly erroring on any JSX prop that starts with on that isn't followed by a capital letter. It's likely that you could use jsx-handler-names from eslint-plugin-react without any modifications
5 replies
SSolidJS
Created by Bit on 6/16/2024 in #support
npm run build fails if outDir is changed
Someone else may have a better answer… I think that's dependent on the preset. For aws-lambda, that may be required
9 replies
SSolidJS
Created by Bit on 6/16/2024 in #support
npm run build fails if outDir is changed
Not all vite options are appropriate in solid-start app.config because the information needs to be sent to Nitro, which will then proxy anything to vite appropriately. To change the output directory, set the server.output.dir property instead:
export default defineConfig({
// ...rest of the config
server: {
preset: 'aws-lambda',
output: { dir: 'dist' },
},
});
export default defineConfig({
// ...rest of the config
server: {
preset: 'aws-lambda',
output: { dir: 'dist' },
},
});
9 replies
SSolidJS
Created by aver6219 on 6/1/2024 in #support
SolidStart ver.1
Just don't use yarn's "pnp" … it's just too flawed
15 replies
SSolidJS
Created by aver6219 on 6/1/2024 in #support
SolidStart ver.1
I use Yarn with prisma, vite, and everything else with teams of varying sizes and many projects for years. No problems
15 replies
SSolidJS
Created by aver6219 on 6/1/2024 in #support
SolidStart ver.1
pnpm's main feature is that it saves disk space by using a different cache and linking strategy that npm lacks. yarn has a "pnp" strategy that does some huge efficiencies in space saving and ensuring package version lock, but I've not seen any major teams really using it, due to the host of problems it tends to create. yarn does, however have a better resolution algorithm, monorepo support, and plugins out of the box (like it will auto install @types/ packages when necessary)
15 replies
SSolidJS
Created by aver6219 on 6/1/2024 in #support
SolidStart ver.1
pnpm does not solve deprecated (sub)dependencies (neither does yarn, bun, or anything else). They just aren't calling out those issues
15 replies
SSolidJS
Created by aver6219 on 6/1/2024 in #support
SolidStart ver.1
No single developer working on bigger projects still uses npm
Just want to say that this is wholely untrue – although I do recommend using yarn or pnpm instead. Most people use what comes out of the box and is the most recommended and familiar, which is npm
15 replies
SSolidJS
Created by peerreynders on 4/12/2024 in #support
Is it possible for all requests and actions to share a server side (singleton) module in memory?
Do you have a minimal repro?
5 replies
SSolidJS
Created by peerreynders on 4/12/2024 in #support
Is it possible for all requests and actions to share a server side (singleton) module in memory?
It's a little hacky, but you can assign things to global. I usually use a symbol to avoid any sort of global variable clash:
const sym = Symbol.for('CLIENT');

function myMiddlware() {
let client = global[sym];
if (!client) {
client = createClient();
global[sym] = client;
}
// ... use the client
}
const sym = Symbol.for('CLIENT');

function myMiddlware() {
let client = global[sym];
if (!client) {
client = createClient();
global[sym] = client;
}
// ... use the client
}
5 replies
SSolidJS
Created by siduck on 2/19/2024 in #support
Solid-start site shows blank page when deployed with github-pages
No description
17 replies
SSolidJS
Created by siduck on 2/19/2024 in #support
Solid-start site shows blank page when deployed with github-pages
No description
17 replies
SSolidJS
Created by siduck on 2/19/2024 in #support
Solid-start site shows blank page when deployed with github-pages
No description
17 replies
SSolidJS
Created by siduck on 2/19/2024 in #support
Solid-start site shows blank page when deployed with github-pages
Can you change the github action to deploy to the gh-pages branch? That'd let you inspect what's actually being published. It looks like it's loading the 404 page, because your resources are actually there and loading, just not the html document you would expect
17 replies
SSolidJS
Created by sh1man on 2/17/2024 in #support
I'd like to see an example of working with a microservices API architecture
That's a pretty loaded request. Under what system are the microservices deployed? How are you working with them? What do the services actually do? Are they available via URL? Using protobuf? t/RPC?
3 replies