Not able to change trace name

I’m using

Plotly.restyle(‘chart’, { name: “foo” }, 0)

to change the name of trace 1, but it’s not working. For example overwriting “opacity” with a similar expression does work, though.