Set plot trace visibility toggle when creating plot

I’m using react-ploty.js, and I’ve got a plot that is periodically updated with new data. Whenever the component is updated the re-render clears the current legend trace visibility toggles. Is there a way to specify the trace visibility via layout/config?

See https://github.com/plotly/plotly.js/issues/2608 for more on this topic.