paoloricciuti / optimistikit

Optimistic UI in sveltekit made easy
MIT License
64 stars 0 forks source link

Example for optimistikit + superforms #50

Open Sillyvan opened 3 months ago

Sillyvan commented 3 months ago

Describe the problem

The docs already mention: "enhance: some libraries like superforms provide a custom enhance function that is different from the one provided by SvelteKit. To allow you to use this libraries together with optimistikit you can pass a custom enhance function. It's important for this function to have the same signature as the sveltekit one."

I honestly didnt manage to make this work. I also asked on the svelte discord. generally i dont see much content about how the enhance of sveltekit works and how to combine them without having 2 requests send or w/e.

So could we maybe get an exmaple on how to do this? Dosent need to be detailed imo.

Describe the proposed solution

Very simple exmaple with superforms doing a simple create action combining both enhance functions

paoloricciuti commented 3 months ago

Yeah I should probably fix the README...super forms does things slightly different and it doesn't really works as of today. I'll check with Andreas to make it work tho