             if @_edges?[edge.id]
               @edgesDS.remove edge.id
               delete @_edges[node.id]
+              ###
+              If user currently inspecting / editing relationship, which just was removed
+              We close inspector
+              ###
+              @relationship.set null if @relationship.get() and @relationship.get().id is edge.id
           else
             if @_edges?[edge.id]
-              @edgesDS.update edge
+              unless EJSON.equals edge, @_edges[edge.id]
+                @edgesDS.update edge 
+                ###
+                If user currently inspecting / editing relationship, which just was updated
+                We update inspector
+                ###
+                @relationship.set edge if @relationship.get().id is edge.id
             else
               @edgesDS.add [edge]
             @_edges[edge.id] = edge


  lastTimestamp = 0
  fetchData = =>
    Meteor.call 'graph', lastTimestamp - 250, (error, data) =>
      if error
        throw new Meteor.Error error
      else

Template.main.events
  'click button#deleteNode': (e, template) ->
    e.preventDefault()
    _n = template.nodeFrom.get()
    if _n
      e.currentTarget.textContent = 'Removing...'
      e.currentTarget.disabled = true
      Meteor.call 'deleteNode', _n.id, (error) ->
        if error
          throw new Meteor.Error error
        else
          template.nodesDS.remove _n.id
          delete template._nodes[_n.id]
          template.resetNodes()
          template.resetNodes('edge')
    false
