发布

  • [OPIK-4509] [FE] fix: annotation queue reason persistence and navigation order (#6664)

    frostbyte_neo 发布于 2026-05-12 08:52:41 +00:00

    • [OPIK-4509] [FE] fix: annotation queue reason persistence and navigation order

    Two customer-reported bugs in the annotation queue flow (CUST-5124, CUST-5125):

    1. Reason field disappears when navigating between items.

      • useDebouncedValue declared an initialValue prop but never passed it to
        useState, so the textarea always started empty regardless of saved data.
      • Even after fixing initialValue, the hook still ignored prop changes after
        mount, so AnnotateRow couldn't display the saved reason when revisiting
        an item. Adopt the focus-based pattern from DebounceInput: while the
        textarea is focused, prop changes are stashed; on blur, the debounced
        callback is flushed and the stashed value is applied. This also fixes
        the latent bug where typed-but-not-yet-debounced reasons were lost if
        the user clicked Next within the 500ms debounce window.
      • handleChangeValue was wiping the saved reason from parent state by
        calling onUpdateFeedbackScore without a reason field. Pass the current
        reasonValue so changing a score value preserves the reason.
    2. "Update + Next" jumps to the first unprocessed item instead of advancing
      sequentially. Customer at item 91 (already processed) with item 1 still
      unprocessed expected Update + Next to go to item 92; the queue jumped
      back to item 1. Branch handleSubmit on isCurrentItemProcessed: Update
      flow goes to currentIndex + 1; Submit flow keeps the existing
      next-unprocessed behavior, which the customer confirmed works for new
      annotations.

    Applied to both v1 and v2 since both versions share the hook and exhibit
    the same bugs.

    • fix(annotation-queue): fall back to next unprocessed when on last item

    Address PR review: when the reviewer is on the last queue item with an
    earlier unprocessed item still pending, the previous Update-flow branch
    attempted setCurrentIndex(currentIndex + 1) which is a no-op at the end
    of the queue, leaving the user stuck. Combine the index check into the
    condition so we fall through to handleNextUnprocessed() — which wraps
    back to the earlier unprocessed item — matching the pre-PR behavior for
    this specific edge case while keeping sequential advance for all other
    Update-flow positions.

    下载附件