scatter
scatter
Explore posts from servers
RRailway
Created by scatter on 5/16/2023 in #✋|help
Storage pricing for Teams
Does railway have pay-per-GB pricing for the enterprise tier? I understand that for the dev tier storage is basically free up to a hard limit of 100GB across your services. Team is $20/seat but if I want to go up to 2TB is there extra cost associated with that?
4 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/26/2022 in #questions
Are tRPC endpoints awaited internally? Endpoint being called again before it finishes
I'm having this weird issue where I want to add a value to an array only if it doesn't already exist. I test this in my endpoint and return an error if so. But it's being called twice due to react's strict mode and in both cases the server hasn't seen the update yet.
// tRPC endpoint
console.log(arrayFromPrisma);
if (arrayFromPrisma.includes(input.value)) {
throw {message: "already included"};
}
await // prisma update array push...
// tRPC endpoint
console.log(arrayFromPrisma);
if (arrayFromPrisma.includes(input.value)) {
throw {message: "already included"};
}
await // prisma update array push...
this is called twice and prints out an empty array both times (and succeeds, and the value ends up in the db array twice). I'm awaiting everything I can. It must be starting one endpoint call before the other is finished, but why? I don't understand how to stop this. My mutate call is wrapped in a useEffect and I even invalidate the get query on cleanup. But it doesn't help because it's calling the endpoint too soon. I'm completely stuck.
9 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/23/2022 in #questions
change query params without rerender
When you useMutation with trpc, you call the endpoint with some input when you call .mutate, which is easy enough to do when you click a button or something. Is it possible to do the same with a query? useQuery takes the input and I don't see a way to change that without rerendering and calling useQuery again - eg type something in a text box and use it for a query without rerendering. I know queries and mutations are pretty much the same under the hood so the solution is to just use a mutation instead but it feels semantically weird to the point that I feel like I'm missing something.
5 replies
TTCTheo's Typesafe Cult
Created by scatter on 9/18/2022 in #questions
nested push-or-create-array in zustand and immer
Is there an easier way to accomplish this with zustand and immer, ie avoiding the conditional? this is inside a zustand create with immer middleware.
// StateType = { knownPaths: { [key: string]: string[] }; };

addPath(region, location) {
set((state) => {
if (region in state.knownPaths) {
state.knownPaths[region].push(location);
} else {
state.knownPaths[region] = [location];
}
});
},
// StateType = { knownPaths: { [key: string]: string[] }; };

addPath(region, location) {
set((state) => {
if (region in state.knownPaths) {
state.knownPaths[region].push(location);
} else {
state.knownPaths[region] = [location];
}
});
},
16 replies
RRailway
Created by scatter on 9/16/2022 in #✋|help
Does railway selectively deploy from monorepos?
If your project uses the /backend subdirectory and you push a commit that doesn't modify files there, will a deploy be triggered? Is there a way to configure this yourself so it works with something like nx (ie when you can't set the subdirectory but still want to deploy based on which directories were changed)?
7 replies
RRailway
Created by scatter on 9/16/2022 in #✋|help
Is railway a good choice for hosting a static frontend?
I know I can just deploy using npm serve but the constant running server seems wasteful compared to some other options. Is there no way to avoid running server costs when deploying static sites? It seems great for db+backend and I'd love it to be an all in one solution.
3 replies