Skip to content

fix(admin): entity service providing correct id on nav back

Rastislav Kruták requested to merge rkrutak/STR-1310/fix_entity_service into main

Description

fix(admin): entity service providing correct id on nav back

  • on navigating back to a component of the same entity but different instance of the entity, the entity service would provide the old id
  • changed the entity service to always check the id it provides with the last numerical path parameter, which should always be the id of the entity
  • the path id is returned on disagreement
  • Commit from STR-1281 was reverted as this is now fixed by this global solution

How to test

Ideally put a console log on the situation where the id from the path differs to that from the stored entity in the entityService. And then try to browse whole GUI checking that the id only gets overwritten when it should. Meaning on navigating back from the same entity.

Author's checklist

  • I have followed the contribution guidelines
  • This MR has been tested or does not change functionality
  • I have added relevant merge request dependencies (if this MR has any)
  • I have added the correct labels
  • I have assigned reviewers (if any are relevant)
  • I have edited the documentation (if the changes require it) or I have noted the need for the change if I do not have access to the documentation
  • I have marked all introduced BREAKING CHANGES or necessary DEPLOYMENT NOTES in the commit message(s)

Reviewer's checklist

  • This MR has been tested or does not change functionality
  • This MR has correct commit message format

Other information

This is pretty hacky and not nice, but I could not think of any other global solution. A nicer way to do this would be to send an ActivatedRoute from each component when using the entityService and then compare the id to these params. This (and any other local solution) would however require changes in ~100 places. But I am open to any other ideas.

Related issues

Closes STR-1310

Edited by Rastislav Kruták

Merge request reports