oakes / Nightlight

An embedded editor for Clojure
https://sekao.net/nightlight/
The Unlicense
788 stars 35 forks source link

Avoid triggering selection on nodes that are not files (leafs) #38

Closed chpill closed 7 years ago

chpill commented 7 years ago

fixes #37

This was more complicated than I would have liked...

I think it would be better to change a bit the design of the files tree, so that the leaf nodes are responsible for triggering the selection function. That way we would not need to search the whole file tree for the target node, just to know if it is a leaf node. The target node could decide simply using its props.

oakes commented 7 years ago

I don't think the added complexity here is worth it. Perhaps a better strategy would be to modify nightlight.core/file-node to store whether or not each node is a file in the :value prop, which is currently just the path name. I'm still not sure it's worth doing at all, though.

chpill commented 7 years ago

You are right, as this does not really cause any UX issues, the complexity is definitely not worth it.