Synphonyte / leptos-use

Collection of essential Leptos utilities inspired by React-Use / VueUse / SolidJS-USE
https://leptos-use.rs/
Apache License 2.0
309 stars 67 forks source link

Fix document.set_cookie usage #96

Closed sbking closed 5 months ago

sbking commented 5 months ago

Setting document.cookie only supports setting a single cookie at a time. Currently use_cookie will try to set multiple cookies by serializing the whole cookie jar. This PR fixes setting and deleting cookies from the client, and adds a second counter to the use_cookie example. This example is broken with the current use_cookie implementation and works correctly in this branch.

Unfortunately cookie uses time so jar.remove doesn't work in WASM, which makes the implementation a bit awkward (have to first add the cookie with value="" and expires=0, and then afterward call jar.force_remove)

sbking commented 5 months ago

I believe this is also related to #95

sbking commented 5 months ago

@maccesch Friendly bump :)

maccesch commented 5 months ago

Thank you very much! Sorry for the delay, the last few weeks have been crazy.