Don
Don
Explore posts from servers
SSolidJS
Created by Don on 11/5/2024 in #support
Tanstack Query+Virtual Suspense reactivity
I am having problems with suspense and query+virtual, using it without virtual works fine though. Just comment out suspense to see that it works afterwards https://stackblitz.com/edit/solidjs-templates-ztdgo1
1 replies
SSolidJS
Created by Don on 11/2/2024 in #support
server function error handling
Is there any error handling in server functions? Because if an RPC gets called and throws an error, it gets stringified and returned with a 200 status code.
export const serverFnCommentAdd = query(
async (args: typeof commentInsertSchema.static) => {
"use server";
return (await rpc.api.comment.post(args)).data!;
},
"comments-add",
);
export const serverFnCommentAdd = query(
async (args: typeof commentInsertSchema.static) => {
"use server";
return (await rpc.api.comment.post(args)).data!;
},
"comments-add",
);
7 replies
SSolidJS
Created by Don on 10/29/2024 in #support
Solid Start tanstack query prefetch
I want to prefetch data into tanstack query server side only, if I do like this I can still see the request in network tab I am comming from nextjs react server components where you can use HydrationBoundary and have the data load server side only, I just dont understand how to do it in solid start
import { RouteDefinition } from "@solidjs/router";
import {
createQuery,
SolidQueryOptions,
useQueryClient,
} from "@tanstack/solid-query";
import { rpc } from "~/lib/rpc";

export const route = {
preload: () => {
const queryClient = useQueryClient();
queryClient.prefetchQuery(commentsQueryOpts());
},
} satisfies RouteDefinition;

const commentsQueryOpts = (props: Partial<SolidQueryOptions> = {}) => ({
...(props as object),
queryKey: ["comments"],
queryFn: async () => (await rpc.api.comment.get()).data!,
});

export default function Chat() {
const commentsQuery = createQuery(() =>
commentsQueryOpts({ enabled: false }),
);

return <div>{commentsQuery.data?.[0]?.id || "nothing"}</div>;
}
import { RouteDefinition } from "@solidjs/router";
import {
createQuery,
SolidQueryOptions,
useQueryClient,
} from "@tanstack/solid-query";
import { rpc } from "~/lib/rpc";

export const route = {
preload: () => {
const queryClient = useQueryClient();
queryClient.prefetchQuery(commentsQueryOpts());
},
} satisfies RouteDefinition;

const commentsQueryOpts = (props: Partial<SolidQueryOptions> = {}) => ({
...(props as object),
queryKey: ["comments"],
queryFn: async () => (await rpc.api.comment.get()).data!,
});

export default function Chat() {
const commentsQuery = createQuery(() =>
commentsQueryOpts({ enabled: false }),
);

return <div>{commentsQuery.data?.[0]?.id || "nothing"}</div>;
}
1 replies
SSolidJS
Created by Don on 5/2/2024 in #support
Solid Start (experiments) nested layout
No description
5 replies
SSolidJS
Created by Don on 5/2/2024 in #support
Solid Start (experiments) nested layout
No description
1 replies