UIRevision on a 3d dcc.Graph doesn't work the first time


I’m trying to draw a new random 3d graph (generated from Perlin noise) on button click. The problem is that uirevision doesn’t save angle and zoom on the first click, only on second and all the next ones.
gen_surface() returns 50x50 np.array

import plotly.graph_objects as go
import dash
import dash_core_components as dcc
import dash_html_components as html
import func
from dash.dependencies import Input, Output

app = dash.Dash()

app.layout = html.Div([
                  style={'height': 800},
        style={'width': '70%', 'display': 'inline-block', 'padding': '0 0'}),

        html.Button(id='new-surface-button', children='New surface')
        style={'width': '30%', 'display': 'inline-block', 'vertical-align': 'top'})

    Output('graph', 'figure'),
    [Input('new-surface-button', 'n_clicks')])
def new_surface(n_clicks):
    surf = func.gen_surface()
    fig = go.Figure(layout={'uirevision': 'const'})  # save zoom and camera angle on fig updating
    fig.add_trace(go.Surface(colorscale="Inferno", z=surf))
    return fig

app.run_server(debug=True, use_reloader=True)