pao ramen
pao ramen
Explore posts from servers
CDCloudflare Developers
Created by pao ramen on 9/28/2024 in #pages-help
Astro + env vars
I really want to use cloudflare, but every time I stumble upon errors or documentation gaps. Let's see if I can come out from this one: I'm building an Astro application with the cloudflare adapter. I've already built one in the past, and on the old, I was using import.meta.env for environment variables with no problem. But for this new one, it seems like they don't work. I've read the documentation in Astro, and it says that I need to use proxyRuntime: { enabled: true } and then access them through const { env } = Astro.locals.runtime, which is weird because this means that I know have to pass the secrets around? Can't I use env variables at build time to set things like the db url or stripe tokens? ok. I keep reading. It looks like I need a wrangler.toml file, but I already have the pages configured through the dashboard and I have no idea how to translate those. Luckily, there is a command npx wrangler pages download config that is supposed to do that. But when I run it I hit: Error: listen EADDRINUSE: address already in use ::1:8976 at Server.setupListenHandle [as _listen2] (node:net:1872:16) at listenInCluster (node:net:1920:12) at GetAddrInfoReqWrap.doListen [as callback] (node:net:2075:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1899:8) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'EADDRINUSE', errno: -48, syscall: 'listen', address: '::1', port: 8976 } I just want to deploy Astro with env variables. Can someone help?
2 replies
SSolidJS
Created by pao ramen on 5/9/2024 in #support
scroll restoration
For some reason, when using solid-router, it does not do scroll restoration properly. I have a list of elements, I scroll to the bottom, I click on one element and when I hit the back button. Customers expect to go back to the bottom of that list, but for some reason it scrolls to the top. I've tried to debug it, and it does not call scrollToHash so I really don't know what else to look at. Thanks in advance!
16 replies
SSolidJS
Created by pao ramen on 3/5/2024 in #support
How do I "curry" a function with props?
I have a method "colorize" that receives two arguments: hue and shade. A component has a props.hue and I want to curry that function. I can't do it with createMemo since the accessor does not receive a parameter. How would you do it? ``` function colorize(hue, shade) { ... } function Component(props: Props) { const color = colorize.bind(null, props.hue) // not reactive! return <span color={color(100)}>hello</span> }
4 replies