News for hackers. Stuff that matters.
Re:Htmx 2.0.0 has been released by cztomsik on Monday June 17, 2024 @05:36PM (#40711345)
can you comment on what those 500 lines actually were? react+redux?
Re:Htmx 2.0.0 has been released by smegsicle on Monday June 17, 2024 @06:18PM (#40711766)
all htmx does is replace divs on the page, so probably just code that did that
Re:Htmx 2.0.0 has been released by gofreddygo on Tuesday June 18, 2024 @12:02AM (#40713955)
can anyone comment on what 500 lines of react+redux actually do ?
Re:Htmx 2.0.0 has been released by LkpPo on Tuesday June 18, 2024 @03:41PM (#40721395)
Also what line N+1 does, please.
Re:Htmx 2.0.0 has been released by simonbarker87 on Tuesday June 18, 2024 @01:44AM (#40714396)
It was all normal JS code to handle a complicated form we have on a customer facing portal page. By moving to htmx I was able to rely on the server side to handle basically everything with only a small addition of code to what it was already doing.
Re:Htmx 2.0.0 has been released by unsupp0rted on Tuesday June 18, 2024 @07:15AM (#40716374)
Isn’t that moving code around, not deleting it?
Re:Htmx 2.0.0 has been released by dlisboa on Tuesday June 18, 2024 @07:20AM (#40716415)
Most likely that code already existed server-side and was duplicated client-side. It's what usually happens since frontend code can't enforce invariants.
Re:Htmx 2.0.0 has been released by simonbarker87 on Tuesday June 18, 2024 @10:15AM (#40718128)
Near enough exactly this
Re:Htmx 2.0.0 has been released by waivek on Tuesday June 18, 2024 @06:31PM (#40722772)
Could you elaborate on what you mean by "frontend code can't enforce invariants" ?
Re:Htmx 2.0.0 has been released by dlisboa on Wednesday June 19, 2024 @12:28PM (#40729795)
Frontend code can be easily bypassed or changed so you can't trust it to keep the state of your application in good condition. Nothing prevents me from picking the same username as someone else if there is no server-side code stopping it. Nothing prevents me from replying to a deleted comment if I don't check with the server.

That means that any validation that you do client-side you need to repeat server-side. Any business logic that you have client-side you also need to repeat server-side.

Re:Htmx 2.0.0 has been released by ghnws on Tuesday June 18, 2024 @08:34AM (#40717067)
I'm qurious what that code was doing that could be just moved to the backend. Usually forms have some validation for a better experience with the final validation on the server. Did you get rid of that and just show an error if the submission failed?
Re:Htmx 2.0.0 has been released by simonbarker87 on Tuesday June 18, 2024 @10:17AM (#40718159)
Near enough yes but it was a nice helpful error message with the form fully populated as they left it - as far as it looks the user it’s client side validation as the service responds with just the correct html for the form and htmx swaps out the chunk of html.

Its like old school for validation back in the CodeIgniter days.

Re:Htmx 2.0.0 has been released by ranger_danger on Saturday June 29, 2024 @08:34PM (#40834321)
So the 500 lines removed was literally just removing functionality in the first place (you should always validate on both sides anyway).