Closed pixelmund closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
š Inspect: https://vercel.com/svemix/svemix/7xexMNpXLA1xzaCGUQAtYEMnsKJv
ā
Preview: https://svemix-git-next-svemix.vercel.app
[Deployment for 645481b canceled]
I'm using svemix in a few of my applications currently, i wasn't really happy with all apis, this should change some stuff and make it a little bit easier imo.
This PR changes a few things:
parseCookies
andmakeCookie
functions which is useful for handling cookies, under the hood it's using a version of thecookie
package but rewritten in typescript. Also if you use sessions viahandleSession
the parsed cookies fromhandleSession
get automatically passed on to locals which reduces overhead of parsing incoming cookies again.getActionData
function, it uses sveltes getContext under the hood and returns ansvelte store
with your action data./__session
if the session updated in an action, so the client stays always in sync with the server and no refresh is required. You can also now pass yougetSession
function tohandleSession
, atm everything in the session get's exposed and you might want to have information in it that doesn't land on the client.{data: { foo: 'bar' }}
instead you should directly return { foo: 'bar' }Breaking:
export let actionData
in your svelte route components, viagetActionData
in children components of this route and via the<Form let:data let:submitting>
, make sure you update everything accordingly, if you need help the docs should show some examples how it works.