Input laggy, when getting input from remote source

I’m trying to build a control page, that get’s a value from a remote Redis server.

My problem is, that the input is kinda laggy, and reverts back to a previus number, when i press the + button. So it goes 1,2,3,4,3,4,5,4,5 instead of 1,2,3,4,5……
(Don’t know how to explain it better :-). )

Is there any good advice, on how to make it, so the input staty’s current with the remote value in the UI.

My code so far :

targetprice = client.json().get('ui', Path('.targetprice'))

inputprice = st.number_input(
        "Target KWH Price",
        value=targetprice,
        min_value=1.0,
        max_value=5.0,
        step=0.1,
        format="%.1f")

update_targetprice(inputprice, targetprice)