Persistence in Dash not updated when server callback updates field

Hi all,

I have a multipage app where I’d like to use persistance=True to save the fields between tabs.

One of these fields is updated by a server callback, but when inspecting the localStorage the value isn’t set in the store. The field really should be persisted, as the server callback is to import data. The user shouldn’t need to reimport when changing tabs back

Minimal reproductive example:

from random import randint
from dash import Dash
from dash.exceptions import PreventUpdate
from dash.dependencies import Output, Input
import dash_html_components as html
import dash_core_components as dcc

app = Dash(
    "plotly",
)  # type: Dash

app.layout = html.Div(
    [
        dcc.Input(
            type="text",
            id="field",
            persistence=True,
        ),
        html.Br(),
        html.Button("Click me", id="btn"),
    ]
)


@app.callback(
    Output("field", "value"),
    Input("btn", "n_clicks"),
)
def update(n):
    if n is None or n == 0:
        raise PreventUpdate

    return str(randint(0, 100))


app.run_server(debug=True, host="127.0.0.1", port=8050)

Looks like there’s an issue for this here: [BUG] Dropdown: programatically set value isn't persisted · Issue #1252 · plotly/dash · GitHub