Skip to content

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

@avf

Description

@avf

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:

  • Add an item with any name
  • Go into edit mode for that item
  • Delete the item
  • Edit mode should be exited, but instead we stay in edit mode for the deleted item, which is an inconsistent state

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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions