phyloref / klados

A curation tool to edit test cases for the Phyloref curation workflow
http://www.phyloref.org/klados/
MIT License
2 stars 1 forks source link

Simply opening a phyloreference marks it as modified #263

Open hlapp opened 2 years ago

hlapp commented 2 years ago

At least in the deployed version (refs/tags/v0.3.1), when I open Brochu 2003 as the example file, then click on phyloreference Crocodylia, it immediately marks as modified, displaying the exclamation point marker and the "This phyloreference has been modified since being loaded! Use 'Save' to save your changes." banner.

hlapp commented 2 years ago

This continues to be the case in deployment release/v0.4.0. However, only the first phyloreference one clicks is marked as modified. Subsequently clicking other phyloreferences does not mark them as modified, too.

gaurav commented 2 years ago

Thanks for reporting this! It looks like the Specifier component adds a label to every taxon concept when it is displayed if it doesn't already exist, which triggers the "this file has changed" code. I'll dig into this further and see if I can figure out why that's happening.

(There is a quick-and-dirty fix for this issue in branch fix-issue-263, which is that if you add an explicit label to every taxon concept in brochu_2003.json, then it won't add labels anywhere. But I suppose we should fix this properly.)

gaurav commented 2 years ago

Principle of least surprise says that ideally the Specifier should not fill in a value on the behalf of the user.

gaurav commented 1 year ago

May have to defer it.

gaurav commented 1 year ago

Actually, it might be possible to fix this by improving the comparison we do here:

https://github.com/phyloref/klados/blob/d3c7b47858e45cabfe2d230ea5bbbc056c0bf369/src/components/specifiers/Specifier.vue#L659

i.e. if we normalize both taxonomic units before comparing them, then we should never update a specifier unless it has in fact changed significantly. Worth trying.

Update (2023nov8): This code should be used everywhere we need to compare two taxonomic units, but we will need similar code for every other type of object we need to compare in the ModifiedCard/ModifiedIcon.

https://github.com/phyloref/klados/blob/2ff610ec17d88e1c59d7b574c276c2a5154db079/src/store/modules/phylogeny.js#L25-L27