Fork me on GitHub
#malli
<
2022-05-05
>
pinkfrog08:05:34

Is there any example that uses malli to validate html forms on the frontend side?

Alexis Schad15:05:05

Hi there, is there a minimal sample project using Malli instrumentation (during dev) in a shadow-cljs webapp? Or is there a recommended configuration for http://malli.dev in cljs? I'm struggling a bit to setup it well. -> thread for more info

Alexis Schad15:05:19

With a basic configuration I got:

Alexis Schad15:05:53

with thrower i got:

dvingo15:05:20

the implementation of that is under active development - if you can use the latest git commit you'll have better errors

dvingo15:05:29

this thread has some background, I suggest adding this metadata to your entry ns: https://github.com/metosin/malli/issues/695#issuecomment-1116884390

Alexis Schad15:05:30

> you'll have better errors The error seems pretty good rn, it's just a problem of formatting them inside the console/devtools I'm looking for your link to see if it can improve something

Alexis Schad15:05:57

With the master version of pretty/reporter, there's a reader conditional for cljs and it now prints well, thanks! I'll see if I have hot reload issue like your link

dvingo15:05:07

nice! yea it's tricky because instrument outputs code where it is called that overwrites the fn - so if you're iterating on the implementation of the the fn in a separate namespace they can get out of sync

Alexis Schad15:05:46

I was using dev/start! but I had to use instrument! instead. I think I don't need the {:dev/always true} metadata, it seems to just work fine without it (I call instrument! every time the app is hot reloaded).

dvingo15:05:37

You'll run into staleness issues described in the ticket without reloading the ns where instrument is called

dvingo15:05:13

if you macroexpand the intstrument call it can help understand why that happens

Alexis Schad16:05:58

I tried to update both the function and the spec and it seems to work well

dvingo18:05:08

nice! well alright then lol

Alexis Schad20:05:21

I didn't even thank you… so thanks!

dvingo00:05:01

for sure! no prob - thanks for trying it out! the leverage from malli is pretty remarkable, just helping to add to that power 🙂

💪 1
Alexis Schad00:05:46

I think I've just had some issues that has been solved with {:dev/always true} Reloading the webapp was doing nothing, I had to restart my shadow-cljs watch. And with the workaround above it seems to work.