yahoo / bgjs

Apache License 2.0
67 stars 11 forks source link

In Tutorial 3, deleting the currently selected item does not exit edit mode #14

Open avf opened 2 years ago

avf commented 2 years ago

First of all, thank you for creating Behavior Graph, and also this amazing documentation. This library looks so damn awesome. After playing around with Elm, FRP (Sodium), and many other such libraries, I stumbled upon this in a very recent HN thread, and I'm extremely excited to try this out!

I found a small bug in the finished Tutorial 3, (also in the JSFiddle) here's how to repro:

I think this can be fixed by modifying the behavior that .supplies(this.selected), by adding this.removeItem to its demands:

        .demands(this.selectRequest, this.save, this.removeItem)

And also changing this else if clause:

        } else if (this.save.justUpdated) {

to:

        } else if (this.save.justUpdated || (this.removeItem.justUpdated && this.removeItem.value === this.selected.value)) {
slevin commented 1 year ago

Sorry. Slow to getting to the documentation fixes. You are correct that it leaves selected in the same state. I think your suggestion is a good one. I'll will work on getting this into the documentation and tutorial code.