Problem with graph updating

I`m using dash to visualize tango bst, and I want to show “unpreffered paths” as dashed lines. However I face a problem. When I visualize a tree first time it works correct, but after I perform a dynamical search, it starts show “preffered paths” dahsed as well. I thought that my algorithm did wrong, but there were two cases for drawing the paths, and when it is about redrawing, the color and the width are taken correctly from the second case, but the “dash” property is wrong. Here is the code:

if new_snapshot['nodes'][node][1]['is_root']:
    color = 'rgb(220,220,220)'
    width = 1.0
    to_dash = "dash"
else:
    color = 'rgb(135,206,250)'
    width = 5.0
    to_dash = None
#endif
#----------------EDGES PATHS FOR TANGO-------------------
curr_pos_node = currentPos(node, f) # coords of the current node placement
curr_pos_next = currentPos(new_snapshot['nodes'][node][1]['parent'], f) # coords of the destination node
edge_between_nodes = go.Scatter(
    x=[curr_pos_node[0], curr_pos_next[0]],
    y=[curr_pos_node[1], curr_pos_next[1]],
    name="Preferred path",
    line={
        'shape' : 'spline',
        'color' : color,
        'dash' : to_dash,
        'width' : width
    },
    mode='lines'
)