clojurescript

icemanmelting 2025-07-25T11:51:15.891049Z

Hey guys, so i am new to cljs and i am experimenting with it, and like every noob, I have an issue, i have a form, and whenever i submit the form, with a on-click event, sometimes it refreshes the screen losing the state (i am using reframe) and sometimes it doesnโ€™t, but the behaviour is never the expected one on the firt try. I know this might be something simple, but have you guys any idea on what can be going on?

p-himik 2025-07-25T11:56:14.116319Z

The default action of a <form> element when some <button> within it is pressed that has the default type or type="submit" is to, well, submit itself - it will cause a page refresh, or a navigation to a different page if the web server responds in a specific way. Sounds like you need :on-submit #(.preventDefault %) in [:form {...}]. Maybe something else should be going on in that handler, e.g. maybe it's :on-submit that should be issuing some relevant re-frame event and not that button since a form can be submitted without any buttons.

icemanmelting 2025-07-25T11:57:12.368849Z

Ok, i Will try that and let you know if it works out

icemanmelting 2025-07-25T11:57:21.168529Z

Thanks!

icemanmelting 2025-07-25T12:01:58.175889Z

@p-himik you're a life saver, it worked! Thanks!

๐Ÿ‘ 1
icemanmelting 2025-07-25T12:02:43.542739Z

btw, on another question, do you know if we can get rid of this warning in console? Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference

liebs 2025-07-25T12:05:06.906679Z

the browser console does allow you to filter by log severity

liebs 2025-07-25T12:05:38.882319Z

That message is probably originating in a JS library you are using and I don't know of a way to disable it

liebs 2025-07-25T12:05:49.200749Z

except to toggle warnings in the console

icemanmelting 2025-07-25T12:05:52.236849Z

yes, but is this one of those warnings that we can get rid of without filtering? I mean make it adhere to the priciples that avoid this log? or is this something that will go away with a prod build?

p-himik 2025-07-25T12:07:01.561239Z

What exactly issues that warning?

icemanmelting 2025-07-25T12:07:32.575279Z

When I open the application it just shows that warning, and it seems to point to react itself, so I would say maybe reagent does it?

icemanmelting 2025-07-25T12:07:55.972529Z

p-himik 2025-07-25T12:08:31.456949Z

Click on that triangle to the left of the warning to see the stacktrace.

icemanmelting 2025-07-25T12:08:58.714109Z

icemanmelting 2025-07-25T12:08:59.270759Z

re-frame-10x

icemanmelting 2025-07-25T12:09:05.849369Z

that must be it

p-himik 2025-07-25T12:12:51.802759Z

Indeed. You're using an older version of re-frame-10x and/or it's misconfigured. See the first text after the table at https://github.com/day8/re-frame-10x?tab=readme-ov-file#compatibility-matrix.

icemanmelting 2025-07-25T12:13:17.090949Z

i switched to 1.10.1

icemanmelting 2025-07-25T12:13:21.519179Z

but i still get the same warning

icemanmelting 2025-07-25T12:13:34.592269Z

https://github.com/day8/re-frame-10x/issues/367

icemanmelting 2025-07-25T12:13:42.607979Z

there's people there complaining about it

p-himik 2025-07-25T12:13:50.433909Z

Did you configure it properly, like that text said that I linked to?

icemanmelting 2025-07-25T12:15:29.880529Z

yes

icemanmelting 2025-07-25T12:15:32.484639Z

now it says this

icemanmelting 2025-07-25T12:15:35.865589Z

icemanmelting 2025-07-25T12:15:41.278639Z

I did what that says, will try now

p-himik 2025-07-25T12:17:27.925309Z

Make sure to fully restart shadow-cljs, just in case. (Some people use separate server and worker processes - everything should be restarted.) If that doesn't work, try removing .shadow-cljs dir from the project.

icemanmelting 2025-07-25T12:17:38.075779Z

ok

icemanmelting 2025-07-25T12:19:59.869569Z

ok, warnings are now gone

icemanmelting 2025-07-25T12:20:10.012919Z

thanks for all your help guys, much appreciated!

๐Ÿ‘ 1