fix: simplify deletion logic #113
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the redundant
getDeletedSceneEntites
function and the corresponding calls.The current logic seems a bit confusing to me. It compares the actually created lane/lane boundary scene entities with the
previous...Ids
lists which track the existence of IDs in the actual OSI messages (even if they are turned off for visualization). Also, the IDs in the state already have been updated to the current state and don't reflect the previous state anymore which makes it even more confusing. The logic actually leads to the deletion of physical/logical lane networks when the config parameters change but also a lot of deletions even if nothing has to be deleted (e.g. when config and lane/lane boundary ID presence hasn't changed):I tried to fix and simplify it by checking the
showLogicalLanes
/showPhysicalLanes
config parameters whengetDeletedEntities
is called and passing an empty list if the parameter is false, which also leads to deletion of the corresponding lane network if it was previously present.@myemural Could you check out the changes?