Altinn / altinn-studio

Next generation open source Altinn platform and applications.
https://docs.altinn.studio
BSD 3-Clause "New" or "Revised" License
109 stars 73 forks source link

Datamodel updates not saved when just moving a field and then generating models. #13022

Open nkylstad opened 5 days ago

nkylstad commented 5 days ago

Description of the bug

See title. Making only changes to the order of fields saves as expected, but if those are the only changes, then clicking "Generer modeller" directly after changing order of fields causes the order to revert back to the old order.

Steps To Reproduce

  1. Navigate to datamodels page
  2. Move a field up or down, and DO NOT make any other changes.
  3. Click "Generer modeller" to generate models and wait for OK response
  4. Re-load the page to re-fetch the model
  5. See that the field has reverted to its old position
  6. Move the field up or down again, and DO NOT make any other changes.
  7. Re-load the page to re-fetch the model
  8. See that the field is in its new updated position
  9. Click "Generer modeller" and wait for OK response
  10. Re-load the page again
  11. See that the field is in its updated position still.

https://github.com/Altinn/altinn-studio/assets/1636323/9f5f121a-3712-4dde-8c52-7de5b33a9603

Additional Information

Updated data model is saved as expected when just changing the order of fields, the issue seems to be with "Generer modeller" directly after changing the field order. Making any other changes, or re-loading the page after changing order, seems to resolve the issue.

Looks like there may be some outdated state used when "Generer modeller" is clicked that is causing this? Re-load of model before generating models seems to do the trick. We should ensure that the updated data model is passed to the backend when generating models.