TOSIT-IO / tdp-ui

Graphical interface for tdp-server
Apache License 2.0
3 stars 2 forks source link

feat: refresh variables when switching service #170

Closed PaulFarault closed 1 year ago

PaulFarault commented 1 year ago

Fixes #169

Which issue(s) this PR fixes

Fixes #169

Additional comments

Agreements

mdrutel commented 1 year ago

Use Case :

Result : the attribute is not modified

mdrutel commented 1 year ago

addendum : when i refresh another time, the modification is OK ^^'

PaulFarault commented 1 year ago

You're right, the value is well actualized in the store but not showed. I'll investigate 👀

PaulFarault commented 1 year ago

TL;DR @mdrutel this should work as expected now

The problem was that we are using uncontrolled form. When loading the page, the field is initialized using the defaultValue which is not updated along with the state, even if the store is refreshed.

Ideally, we could use controlled form to update the field. This could be worked along with #164.

My solution was to initialize the defaultValue with right value since the beginning. I did it by re-fetch the value from the server directly after a successful PUT operation.

pvalentin01 commented 1 year ago

Use case 1 :

Result : The attribute is modified

Use case 2 :

Result : The attribute is modified

mdrutel commented 1 year ago

Now it's all fine, variable values are well refreshed ^^