Persistence of programmatically updated value


I use persistence=True on components with a value (dcc.Input, dcc.Dropdown) which works great as long as the value is manually picked by the user. If I update the value via a callback, it looks like the persistence mechanism is not triggered. has anyone encountered this before?

Minimal reproducible example, to see the issue refresh the page after either typing something in the input or clicking the button:

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import numpy as np

app = dash.Dash(__name__)
app.layout = html.Div([
    dcc.Input(id="input", persistence=True),
    html.Button("Pick a random number", id="button")

@app.callback(Output("input", "value"), Input("button", "n_clicks"))
def pick_random_number(n):
    if n:
        return np.random.randint(0, 1_000_000_000)
    return dash.no_update

if __name__ == "__main__":