Hi @9eqUoa2vHj welcome to the forum! You need to specify the range of the xaxis, not the one of the rangeslider:
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label="1M",
step="month",
stepmode="backward"),
dict(count=3,
label="3M",
step="month",
stepmode="backward"),
dict(count=6,
label="6M",
step="month",
stepmode="backward"),
dict(count=1,
label="YTD",
step="year",
stepmode="todate"),
dict(count=1,
label="1Y",
step="year",
stepmode="backward"),
dict(label="All",
step="all")
])
),
rangeslider=dict(
visible=True,
#range=(dates[0], dates[-1])
),
range=(dates[0], dates[-1]),
type="date"
)
)