A sample SvelteKit application built to illustrate the usage of trpc-sveltekit.
Huge thanks to Alex / KATT, for bringing us tRPC and for being the first sponsor of tRPC-SvelteKit! 🎉
The ISC License.
A sample SvelteKit application built to illustrate the usage of ✨ trpc-sveltekit.
Home Page: https://icflorescu.github.io/trpc-sveltekit
License: ISC License
A sample SvelteKit application built to illustrate the usage of trpc-sveltekit.
Huge thanks to Alex / KATT, for bringing us tRPC and for being the first sponsor of tRPC-SvelteKit! 🎉
The ISC License.
The CodeSandbox generates a lot of errors and doesn't start
Hi @icflorescu thanks for the clear example.
Do you have any plan (to add example) or idea on how to do file/image uploading?
Thank you
I was reading through the tRPC Error Handling docs, but wasn't quite sure how to implement that using trpc-sveltekit.
I figured this example project would be a great place for that. :-)
Right now, visiting a page that has a trpc query in it's load
function (ex. /authors
) , will result in that trpc query running twice. First on the server, then again on the client. This is happening (I think) because we're not using the fetch
provided by load
.
Note: This is only applicable to the first request, since all other requests after that are client side only.
There two ways to go around this issue:
load
to a page endpoint
.fetch
provided by load
. No idea how.This would ensure that the request would not happen twice. It would happen only on the server.
From the docs:
When fetch runs on the server, the resulting response will be serialized and inlined into the rendered HTML. This allows the subsequent client-side load to access identical data immediately without an additional network request.
Update the example to the newest version of SvelteKit due to mayor changes in Folder structure.
i remember having a lot of trouble to add auth in my app using this library (because of the cookies). i was able to get it to work, but after the recent sveltekit update (which removed the session store) im having a lot of trouble to get it to work
it would be nice to showcase authentication via cookies in this example
I apologize if this is a dumb question, but I am quite new to tRPC and still trying to figure stuff out. Why, in every method in the .svelte
templates is the trpc
client invoked for each query, mutation, etc? Eg,
const reloadBooks = async () => {
loading = true;
data.books = await trpc().query('books:browse', query);
loading = false;
};
This doesn't seem to be a thing in the server code, where trpc()
is invoked once and is then reused mutiple times. Won't doing that work in the client code?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.