Open theronic opened 8 years ago
Wouldn't (reset! max-id (.-id msg)) suffice?
That's correct. If the swap fn doesn't make any use of the current state (%
in this case), then you can be certain that the new value doesn't depend on the old.
Happy to accept a PR on this, though no idea what the state of the repo/example is otherwise or how many people use this.
Just curious about the use of
swap!
on this line, https://github.com/http-kit/chat-websocket/blob/master/src-cljs/main.cljs#L36, where you havein case there is concurrency I'm not aware of.
Wouldn't
(reset! max-id (.-id msg))
suffice?