fix: Submit/confirm prediction button disabled state#6989
Conversation
⏱️ Backend import time —
|
| Accelerator | Cumulative (s) | Self (s) |
|---|---|---|
cpu |
4.104 | 0.003 |
xpu |
4.394 | 0.003 |
cuda |
4.630 | 0.003 |
There was a problem hiding this comment.
Pull request overview
Fixes an annotator submit/confirm button disabled-state regression in the UI by ensuring annotation “confidence” data is normalized consistently between server DTOs and local models, and by tightening the submit-disable logic when annotations are invalid.
Changes:
- Normalize
mapLocalAnnotationsToServerto always includeconfidences(asnullwhen absent) to avoid false “changed” comparisons. - Add unit/regression tests covering confidence round-tripping and
canSubmitbehavior on initial load. - Centralize submit-disable logic in
getIsSubmitDisabled, preventing submission when annotations are invalid even if subset selection changes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| application/ui/src/shared/annotator/annotation-mappers.ts | Always emits confidences (null when no probabilities) to match backend DTO shape and stabilize equality checks. |
| application/ui/src/shared/annotator/annotation-mappers.test.ts | Adds unit tests for confidence mapping and DTO round-trip equality (new test file). |
| application/ui/src/shared/annotator/annotation-actions-provider.test.tsx | Adds regression coverage for canSubmit on initial load when server annotations include confidences: null. |
| application/ui/src/features/dataset/media-preview/secondary-toolbar/util.ts | Introduces getIsSubmitDisabled to encapsulate submit-disable rules across modes and invalid states. |
| application/ui/src/features/dataset/media-preview/secondary-toolbar/util.test.ts | Adds unit tests validating getIsSubmitDisabled behavior for annotation vs prediction modes and saving/loading flags. |
| application/ui/src/features/dataset/media-preview/secondary-toolbar/secondary-toolbar.component.tsx | Switches submit-disable computation to getIsSubmitDisabled and includes invalid-annotation signal from actions provider. |
📊 Test coverage report
|
🐳 Docker image sizes
|
|
|
||
| // If annotations are not changed but subset has changed we want to allow user to submit | ||
| const isSubmitDisabled = (!canSubmit && !hasSubsetChanged) || isSaving || isLoadingPredictions; | ||
| const isSubmitDisabled = getIsSubmitDisabled({ |
There was a problem hiding this comment.
why not useIsSubmitDisabled and call useAnnotationActions there since here we're just passing them around from 1 hook to an util
There was a problem hiding this comment.
No strong reason, we still need to call useAnnotationActions to get submitAnnotations, submitPredictions, initialAnnotations, initialPredictions. But we can move to hook itself as well if you find it better.
There was a problem hiding this comment.
yeah i know, but here the method is just used as a bridge, we can just get it directly if it becomes a hook
Summary
mapLocalAnnotationsToServerdon't includeconfidences: nullwhen there is noconfidence- causingisEqualto be true.How to test
Checklist