HumanSignal / label-studio-frontend

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package
https://labelstud.io/
Apache License 2.0
421 stars 316 forks source link

fix: LEAP-640: Don't save empty draft on View All #1689

Closed hlomzik closed 9 months ago

hlomzik commented 9 months ago

We should save draft when user clicks on View All, but we should save it only if there are changes made to annotation.

PR fulfills these requirements

Describe the reason for change

Draft is created/updated every time user click on View All, even if that's fresh new task, if there are no changes, if draft was saved a second ago.

What alternative approaches were there?

We could add checks for actual changes to saveDraftImmediatelyWithResults(), but the whole approach should be revisited. So current fix is a quick patch for the actual problem. Also the main reason for draft not being saved is the check for editable in saveDraft() — at this moment View All is already displayed and all annotations are not editable. Most probably it will be enough just to rewrite this check to check for annotation explicitly.

This change affects (describe how if yes)

Does this PR introduce a breaking change?

What level of testing was included in the change?

hlomzik commented 9 months ago

/git merge master

Workflow run Already up-to-date. Nothing to commit.