Live data from Hacker News

Htmx 2.0.4 Released

github.com

11–20 of 136 posts

Re: Htmx 2.0.4 Released

#11

> Calling htmx.ajax with no target or source now defaults to body (previously did nothing) This one jumped out to me as an interesting one for a patch release. Changing the default behavior feels like a breaking change, though hopefully there weren't sites expecting an ajax call to not do anything.

> though hopefully there weren't sites expecting an ajax call to not do anything It didn’t need to do nothing , it just needed to have no visible effect. I would be absolutely astonished if this affected no one. It’s very easy to imagine someone having written htmx.ajax("GET", "/some-tracker-that-returns-nothing-or-json-or-something") And now your body is clobbered, leaving either nothing behind or a raw JSON respons…

Yeah I tend to agree this should have been in a minor rather than a patch release. The reality is that I tend to regard the JavaScript api as an afterthought (the html attributes are the main api) and the existing behavior seemed like a nonsensical bug, but on reflection I wouldn’t have changed the html api like that and should treat the JavaScript api the same way.

Re: Htmx 2.0.4 Released

#12
post #6

There's a question I've had about htmx for some time, might as well ask it here. Why does it keep the history cache in localStorage and not sessionStorage or memory? Some kind of a microoptimization? sessionStorage seems like it would be better to me if it's really a good default. I also think it should be publicized more, because it unexpectedly keeps stuff in a location that can be accessed more easily and beyond w…

memory wouldn't survive a page refresh sessionStorage wouldn't survive a tab close i'm not opposed to making the latter an option though

> memory wouldn't survive a page refresh

That isn't very common.

> sessionStorage wouldn't survive a tab close

When a tab is restored, the browser typically restores sessionStorage.

> i'm not opposed to making the latter an option though

That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a security concern.

Re: Htmx 2.0.4 Released

#13

Earlier quoted context omitted.

memory wouldn't survive a page refresh sessionStorage wouldn't survive a tab close i'm not opposed to making the latter an option though

> memory wouldn't survive a page refresh That isn't very common. > sessionStorage wouldn't survive a tab close When a tab is restored, the browser typically restores sessionStorage. > i'm not opposed to making the latter an option though That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a securit…

> When a tab is restored, the browser typically restores sessionStorage

Is it guaranteed to do this? Otherwise, if it just sometimes does it, or different browsers handle it differently/may change in the future, it seems like a recipe for problems.

Re: Htmx 2.0.4 Released

#14

Earlier quoted context omitted.

memory wouldn't survive a page refresh sessionStorage wouldn't survive a tab close i'm not opposed to making the latter an option though

> memory wouldn't survive a page refresh That isn't very common. > sessionStorage wouldn't survive a tab close When a tab is restored, the browser typically restores sessionStorage. > i'm not opposed to making the latter an option though That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a securit…

A page refresh isn't common?

Re: Htmx 2.0.4 Released

#15

Earlier quoted context omitted.

memory wouldn't survive a page refresh sessionStorage wouldn't survive a tab close i'm not opposed to making the latter an option though

> memory wouldn't survive a page refresh That isn't very common. > sessionStorage wouldn't survive a tab close When a tab is restored, the browser typically restores sessionStorage. > i'm not opposed to making the latter an option though That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a securit…

i don't know how common it is or isn't, but it's reasonably common for htmx to be sprinkled into a regular MPA with full page navs, etc. and memory wouldn't survive that

no strong opinions on session vs local storage, i was trying to make htmx act as much like the browser as possible and the browser caches across tabs

you can disable history on any page by using the hx-history attribute and you can force a server request on every history navigation by setting the htmx.config.historyCacheSize config option to 0:

https://htmx.org/docs/#disabling-history-snapshots

https://htmx.org/docs/#htmx-security-tools

Re: Htmx 2.0.4 Released

#16
post #14

Earlier quoted context omitted.

> memory wouldn't survive a page refresh That isn't very common. > sessionStorage wouldn't survive a tab close When a tab is restored, the browser typically restores sessionStorage. > i'm not opposed to making the latter an option though That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a securit…

A page refresh isn't common?

I'm wondering how they use this site

Re: Htmx 2.0.4 Released

#17
Nothing new under the sun. This is just a rip off of intercooler js. Only without jQuery. Times moved on and someone copied the idea (exactly) but with the aid of modern JavaScript didn't need jQuery.

I mean it's nice that it's a bit more modern but still.

Re: Htmx 2.0.4 Released

#18
post #17

Nothing new under the sun. This is just a rip off of intercooler js. Only without jQuery. Times moved on and someone copied the idea (exactly) but with the aid of modern JavaScript didn't need jQuery. I mean it's nice that it's a bit more modern but still.

You do realize that htmx is intecooler.js 2.0? Made by the same people, for the same purpose. And if you don't believe me, the intercooler.js homepage says pretty much the same exact thing.

Re: Htmx 2.0.4 Released

#19

Earlier quoted context omitted.

> memory wouldn't survive a page refresh That isn't very common. > sessionStorage wouldn't survive a tab close When a tab is restored, the browser typically restores sessionStorage. > i'm not opposed to making the latter an option though That isn't what I was getting at. If I'm going to buy into htmx, I want to understand the design. I wondered why this was the default, and why I hadn't seen it mentioned as a securit…

> When a tab is restored, the browser typically restores sessionStorage Is it guaranteed to do this? Otherwise, if it just sometimes does it, or different browsers handle it differently/may change in the future, it seems like a recipe for problems.

Not guaranteed, no. Thankfully.

Chrome does, however, if the “resume where i left off” setting is enabled.

Re: Htmx 2.0.4 Released

#20
post #17

Nothing new under the sun. This is just a rip off of intercooler js. Only without jQuery. Times moved on and someone copied the idea (exactly) but with the aid of modern JavaScript didn't need jQuery. I mean it's nice that it's a bit more modern but still.

Just in case this isn’t sarcasm, you may be interested to know they’re made by the same person.

https://news.ycombinator.com/item?id=23330881

Post reply on HN