thoth icon indicating copy to clipboard operation
thoth copied to clipboard

Changing Units selection on Work page reverts any unsaved changes in other fields

Open rhigman opened this issue 3 years ago • 1 comments

Steps to reproduce:

  • On the page of an existing Work, change the value(s) in any editable field(s).
  • Change the unit of measurement selected in the Units dropdown.
  • All fields changed in the first step will revert to their original values.

This occurs because Msg::ChangeLengthUnit triggers a re-render of the page, and the change() method then fires Msg::GetWork, which results in all fields being updated with their database values. (The same thing would occur if a user's permissions were changed while they were in the middle of editing a Work. In this case, the effect could be mitigated by splitting out GetWork and only calling GetImprints, as is done in new_work.rs.)

While it appears that changed dropdown selections are not reverted, inspection of the element shows that the underlying value has in fact changed without the display updating, and attempting to save the edited work confirms this. (This is another effect of the known problem noted in https://github.com/jgthms/bulma/issues/3390.)

This does not affect the New Work page, as there are no existing width/height values to retrieve from the database, so no re-render is triggered.

As noted in #250, we want to improve the MVC pattern of the GUI; this is another point to address when we do.

rhigman avatar Dec 10 '21 13:12 rhigman

Units dropdown was removed under #357 so the main described issue no longer occurs. It is still possible for a permissions change to revert users' in-progress edits.

rhigman avatar Mar 21 '22 11:03 rhigman