Blankeos
Blankeos
Explore posts from servers
SSolidJS
Created by Blankeos on 6/18/2024 in #support
DeepTrack for a `Component[]` (Deeptrack for functions)
11 replies
SSolidJS
Created by Blankeos on 6/18/2024 in #support
DeepTrack for a `Component[]` (Deeptrack for functions)
Any suggested workarounds for this'?\
11 replies
SSolidJS
Created by Blankeos on 6/18/2024 in #support
DeepTrack for a `Component[]` (Deeptrack for functions)
Nevermind. It kinda works. No idea what happened. Okay, it's back again. there definitely is an issue when you do reconcile for an Array of functions.
11 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
Thanks bud. Was able to solve it thanks to the links!
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
No description
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
Interesting! Thanks for this.
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
No description
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
I tried doing your solution but no luck
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
Btw for context, I'm trying to code Vike's SSR for rendering cumulative layouts atm. Basically, there's a layouts: FlowComponent[] and a children: JSX.Element. I'm trying to wrap children with a bunch of layouts essentially.
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
Thanks @REEEEE ! It seemed to work but I'm getting hydration issues. (Essentially the backend rendered my component differently, and the frontend also rendered it differently). Maybe because for my case, I'm rendering UI as well (other than context). Wondering if @mdynnl 's solution would work. Can you elaborate on using createMemo here? Also, render(0), do you mean the fn(0) used in the MultiProvider example?
19 replies
SSolidJS
Created by Blankeos on 6/13/2024 in #support
How do I recursively wrap a `JSX.Element` with an `Array<FlowComponent>`
19 replies
SSolidJS
Created by Blankeos on 6/10/2024 in #support
SolidStart is it possible to make `load` function on Solid Router async?
No description
10 replies
SSolidJS
Created by sabercoy on 6/4/2024 in #support
The combination of API routes and data loading functions
Yes it will. But in my days of just building getServerSideProps apps with NextJS. Don't think it's really that big of a deal.
52 replies
SSolidJS
Created by sabercoy on 6/4/2024 in #support
The combination of API routes and data loading functions
I've done this for Hono as well actually which is btw technically rest compatible. If you use axios, you can pretty much do the same thing of making an initializer before making a GET or POST call in the server. const client = initAxiosSSR(requestHeaders, responseHeaders) client.POST() the request headers would be sent and the response headers would be sent back when the data loader finishes.
52 replies
SSolidJS
Created by sabercoy on 6/4/2024 in #support
The combination of API routes and data loading functions
Looks awesome! I'll go check it out!
52 replies
SSolidJS
Created by sabercoy on 6/4/2024 in #support
The combination of API routes and data loading functions
Hi. Actually I've addressed this by making a separate client just for SSR fetch. It's basically a polyfill of fetch but you have to inject the REQUEST header + the RESPONSE header that initiated the page render request in the data loading function. Here's how I do it in trpc:
export const initTRPCSSRClient = (
/** Pass the request headers sent by the browser here. */
requestHeaders: Headers,
/** Pass the response headers to be sent back to the browser here. */
responseHeaders: Headers
) => {
return createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: `${publicConfig.BASE_ORIGIN}/api/trpc`,

// Proxy the Request headers from the browser -> server.
headers: () => requestHeaders ?? {},

// Proxy the Response headers from the server -> browser.
fetch: async (url, options) => {
const response = await fetch(url, options);

// This is where we proxy it back.
for (const [key, value] of response.headers) {
// Don't set back the Content-Type header (Otherwise, content-type HTML would become a json).
if (key.toLowerCase() === 'content-type') continue;

responseHeaders?.set(key, value);
}

return response;
},
}),
],
});
};
export const initTRPCSSRClient = (
/** Pass the request headers sent by the browser here. */
requestHeaders: Headers,
/** Pass the response headers to be sent back to the browser here. */
responseHeaders: Headers
) => {
return createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: `${publicConfig.BASE_ORIGIN}/api/trpc`,

// Proxy the Request headers from the browser -> server.
headers: () => requestHeaders ?? {},

// Proxy the Response headers from the server -> browser.
fetch: async (url, options) => {
const response = await fetch(url, options);

// This is where we proxy it back.
for (const [key, value] of response.headers) {
// Don't set back the Content-Type header (Otherwise, content-type HTML would become a json).
if (key.toLowerCase() === 'content-type') continue;

responseHeaders?.set(key, value);
}

return response;
},
}),
],
});
};
As much as people advice not to call the API again. I think in terms of maintainability, it helps because I usually use my routes in either a SPA environment (credentials are present) and SSR environment (where I still want to pass credentials, but the only need is to really hydrate the HTML for SEO or Social Share stuff). I would personally never mess with telefunc or a "server function" that calls some data access object on a page data loader. I'm comfortable just double-calling the API.
52 replies
SSolidJS
Created by Blankeos on 6/8/2024 in #support
Is there a way to hydrate signals on the server?
Okay, I now realize I can actually just set it as part of the initial state and it would be included in the html response. createSignal(initialState)
2 replies
SSolidJS
Created by Blankeos on 6/7/2024 in #support
Meta head management with title template?
Thanks Brendon! I'll look into it a bit more.
8 replies
SSolidJS
Created by Blankeos on 6/7/2024 in #support
Meta head management with title template?
8 replies
SSolidJS
Created by Blankeos on 6/7/2024 in #support
Meta head management with title template?
Thanks, I checked this out but I couldn't find anything about what I'm looking for: For instance on the root layout: titleTemplate="MySite.com - %s" - Then on About: title="About" and my head would automatically become: MySite.com - About - Another, on Login: title="Login" and my head would automatically become: MySite.com - Login
8 replies