cljs-dev

borkdude 2026-06-29T10:17:01.190129Z

It seems add-watch isn't lite-mode compatible since it uses doseq - could this be fixed? I'm trying to keep Reagami lite-mode compatible, but people probably would want to use add-watch to re-render stuff on atom change

borkdude 2026-06-29T10:22:52.779039Z

Not sure if it's important enough but it seems using (atom ..) in an app pulls in chunked-seqs via doseq. I tried making reagami CLJS-lite compatible but using an atom + add-watch is essential to its UX

dnolen 2026-06-29T11:06:13.158719Z

Yeah atom is a bit annoying but the implementation was a bit too tangled up to want to deal with, I think volatile is better?

borkdude 2026-06-29T11:12:04.441089Z

volatile! doesn't have add-watch :-(

borkdude 2026-06-29T11:12:24.715049Z

on Atom I think doseq could be replaced with run! or so

borkdude 2026-06-29T11:13:40.316649Z

but not sure if that solves all the issues

dnolen 2026-06-29T13:33:13.272139Z

I doubt it, I looked at this a bit but my conclusion if you want atom you have to be ok w/ what that implies.

borkdude 2026-06-29T13:34:00.413249Z

ok I guess people can write their own cljs-lite atom then

dnolen 2026-06-29T13:55:12.902369Z

yeah I think that's reasonable, changing implementation details to accommodate light mode is not that awesome. Aside from pretty low level details of printing - this was avoided.

borkdude 2026-06-29T13:57:16.649369Z

yeah, we have IAtom, ISwap etc anyway

Kimo 2026-06-29T15:37:53.989409Z

Here's an example - it's a bit lighter than regular Atom https://github.com/kimo-k/core-lite/blob/cdc9e4649353b38bae12c8193b5b361c4c84db43/src/core/lite.cljc#L118

Kimo 2026-06-29T15:38:54.463959Z

add-watch
  cljs-core  |||||||||||||||||||||||||||||||||||||||||||||||||| 8405 bytes (brotli)
  core-lite  |||||||||||||||||||||||||||||||||||||||||| 7209 bytes (brotli)

swap!
  cljs-core  |||||||||||||||||||||||||||||||||||||||||||||||||| 4757 bytes (brotli)
  core-lite  |||||||||||||||||||||||||||||||||||||||||| 4060 bytes (brotli)

Kimo 2026-06-29T15:52:16.835689Z

It gets much lighter if you store watches in a js/Map: https://github.com/kimo-k/core-lite/blob/8aef307a92e1be2f74efedbfd96b6e3e5daafb38/src/core/lite.cljc#L118

add-watch
  cljs-core  |||||||||||||||||||||||||||||||||||||||||||||||||| 8405 bytes (brotli)
  core-lite  ||||||||||||||||||||||| 3983 bytes (brotli)

swap!
  cljs-core  |||||||||||||||||||||||||||| 4757 bytes (brotli)
  core-lite  ||||||||||||||||||||| 3534 bytes (brotli)

borkdude 2026-06-29T15:55:26.340709Z

you're re-implementing squint ;)

2