Fork me on GitHub
#fulcro
<
2021-08-20
>
Thomas Moerman15:08:25

@pt.roterski haven't tested it yet to confirm, but i think there's a small bug in the [adapter](https://github.com/roterski/fulcro-rad-crux/blob/d643d7ce600c242d7e1e85f2819e4e3041f75d24/src/main/roterski/fulcro/rad/database_adapters/crux/wrap_crux_save.clj#L21) -> the and expression tests v but an attr with v being false should be kept as well. Testing with (some? v) is probably what is needed here. What do you think? I can log an issue later if you like.

Piotr Roterski20:08:52

Nice find @U052A8RUT ! Thank you for reading through this code. Let's think. This is the context:

(reduce (fn [e [k v]]
                                              (cond-> e
                                                (and v (get e k)) (assoc k v)))
                                            entity
                                            before)
We go over a seq of maps before, and if condition (and v (get e k)) is truthy a value v will be associated assoc under key k in entity e. If v is false :
(and false 5)
  ;; => false

  (and (some? false) 5)
  ;; => 5
without (some? v) falsevalues get silently ignored. That's not an expected behaviour. You are right, this is a bug and I'll fix this.

Piotr Roterski20:08:43

Thanks again for finding it, I appreciate it. 🙏 Feel free to use https://github.com/roterski/fulcro-rad-crux/issues for more persistent issue tracker.

metal 2
Thomas Moerman21:08:43

You're welcome! Thank you for sharing this code 🙏

😊 2
Piotr Roterski11:08:48

@U052A8RUT just an update, I've pushed a fix together with a test case catching the bug https://github.com/roterski/fulcro-rad-crux/pull/3 and then released it as 0.0.1-alpha-4