mrk
mrk
DDeno
Created by anggoran on 4/3/2024 in #help
Signals & Data Fetching
Oh I see, so it does make sense as a great place to declare shared global signals for multiple islands to import 👌 ... And yeah, after using fresh for a while, the server-client boundary is what takes the most time to get used to and requires changing one's mental model (coming from SPA's myself at least). I see how this could hugely enhance DX if signal reactivity could cross this border. Apart from frameworks looking into these patterns, there's also SignalDB which accomplishes something similar (more like a Signals-based abstraction over arbitrary databases/datastores/apis), though it's framework agnostic. Might be of interest too 👍
16 replies
DDeno
Created by anggoran on 4/3/2024 in #help
Signals & Data Fetching
Some thoughts: Would there be a reason to pass data wrapped in a signal from an async route to a client component/island? Reactivity is not carried over the wire and the server has no client/user interaction, so no need for reactivity there, right? I guess you where just answering for completeness @marvinh. , since signals are indeed serializable by fresh and sent over-the-wire. Just making sure I'm not missing out on some server signal use case 😃 This reminds me of a blogpost I read about Ryan Carniato where he hints on a future with server-to-client signals, that is, where reactivity trascends the server/client border. Maybe this could be done using WebSockets/SSE, definitively interesting...
16 replies
DDeno
Created by 177177177 on 12/7/2023 in #help
Can you make a fresh route detect, if it is being requested by `deno run`
You might be able to solve this like fresh does this for /routes/update by simply checking req.headers.get("accept"):
import { Handlers, PageProps } from "$fresh/server.ts";
import VERSIONS from "../../versions.json" assert { type: "json" };

export const handler: Handlers = {
GET(req) {
const accept = req.headers.get("accept");
let path = "/docs/concepts/updating";
if (accept && !accept.includes("text/html")) {
path = `https://deno.land/x/fresh@${VERSIONS[0]}/update.ts`;
}
return new Response(`Redirecting to ${path}`, {
headers: { "Location": path },
status: 307,
});
},
};
import { Handlers, PageProps } from "$fresh/server.ts";
import VERSIONS from "../../versions.json" assert { type: "json" };

export const handler: Handlers = {
GET(req) {
const accept = req.headers.get("accept");
let path = "/docs/concepts/updating";
if (accept && !accept.includes("text/html")) {
path = `https://deno.land/x/fresh@${VERSIONS[0]}/update.ts`;
}
return new Response(`Redirecting to ${path}`, {
headers: { "Location": path },
status: 307,
});
},
};
8 replies
DDeno
Created by mrk on 9/20/2023 in #help
Deno-native Nuxt.js?
Great idea @birkskyum !!! I hope we get there soon!
7 replies