createServerFn. My goal is to have the ability to send a websocket message from a server function. The way I've tried to do this, is to create a Map() instance, in which I place websocket "peers", and then I'm attemting to retreive the appropriate peer from the server-side function. However, the Map isn't shared, it seems like the file where createServerFn is located, is loaded dynamically by Start, which means the Map is always a new instance rather than being the existing one. src/lib/peerManager.ts exports a singleton export const peerManager = new PeerManager(); src/ws.tsx imports the singleton, handles websocket, works greatsrc/lib/websocket.ts imports the singleton but only actually imports it when receiving a request, and it's always a new instancesrc/routes/user.tsx calls websocket.ts' function and that triggers creating a new instance without the expected peers in it. Nota Bene: The peerManager was how I felt was the "only" way to share data between the websocket implementation, and the user context for a logged in user - I'm usingfor auth if that matters. This maybe be an x/y problem and someone can tell me how to share a session/context between the WS and createServerFn without this peer mapping. I'm not attached to the mapping solution, it's just what I thought might work!Clerk
https://x.com/powersync_/status/2010721010006552775?s=20
dry-scarlet · 2mo ago
You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 3mo ago
TanStack AI Alpha 2 is here! 🖼️ Image, video, audio, speech, transcription, structured output 📦 Split adapters = smaller bundles, faster dev/contributions, easier 🎄 Fully tree shakable adapters ✨ Cleaner, flattened, fully type-safe APIs https://tanstack.com/blog/tanstack-ai-alpha-2
dry-scarlet · 3mo ago