Repository navigation
Emit update:interaction only on a content change - #6360
rtibblesbot wants to merge 3 commits into
Conversation
AlexVelezLl
left a comment
There was a problem hiding this comment.
After rebasing onto unstable:
- Let's resolve the conflict in
associate/__tests__/Editor.spec.js, then re-run the "type, then Close at once" QA for associate and match on top of #6357, which also changed when an open chip commits as it closes. - Could you please move the gap match editor (added in #6354) onto
useInteractionUpdatestoo, with the same emit tests? It still haswatch(workingInteraction, ..., { immediate: true })ingapMatch/Editor.vue, so it emits on mount in any mode.
| if (props.mode !== 'edit' || isEqual(newVal, oldVal)) return; | ||
| emit('update:interaction', newVal); | ||
| }, | ||
| { flush: 'sync' }, |
There was a problem hiding this comment.
Could you please carry over the comment this replaced in associate and match (each rebuild is a fresh object, so compare by value), and add a line on why this watcher has to be sync? Without it, the flush looks arbitrary and is easy to drop, which would bring back the lost edit on Close.
There was a problem hiding this comment.
Done: useInteractionUpdates.js now carries the compare-by-value comment from associate/match, plus one on flush: 'sync' — QTIItemEditor saves an update only while the card is in edit mode, so an edit made as the card closes has to be reported before that mode change lands.
Searched the QTIEditor tree for other watchers on workingInteraction that emit update:interaction: none left; all seven editors go through the composable.
Written by rtibblesbot, an LLM-based coding agent.
| import { watch } from 'vue'; | ||
| import isEqual from 'lodash/isEqual'; | ||
|
|
||
| export function useInteractionUpdates(workingInteraction, props, emit) { |
There was a problem hiding this comment.
Could you please take a callback instead of emit, so each editor still shows what it emits? Something like useInteractionUpdates(workingInteraction, () => props.mode, newVal => emit('update:interaction', newVal)). That also keeps the whole props object out of the composable.
There was a problem hiding this comment.
Done: the signature is now useInteractionUpdates(workingInteraction, getMode, onUpdate). All 7 call sites (associate, match, choice, ordering, text entry, inline choice, gap match) pass () => props.mode and newVal => emit('update:interaction', newVal).
Written by rtibblesbot, an LLM-based coding agent.
Move the update:interaction watcher into useInteractionUpdates with a sync flush, so QTIItemEditor still reads edit mode when it lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Choice, ordering, text entry, inline choice and gap match editors no longer emit on mount, on entering edit mode, or on a rebuild equal by value. Text entry still reports a stored numeric answer it canonicalizes on opening. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Typing a space after a gap that ends a paragraph, then a letter, made the letter a new gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d438463 to
6adbe6f
Compare
Written by rtibblesbot, an LLM-based coding agent. |


Summary
References
Fixes #6136. Follows #6113.
Reviewer guidance
Suggested review: Full code review, then manual QA once the reviewer sets Needs QA.
Engineer review
1.50) still emits once (interactions/textEntry/Editor.vue, mode watcher).useInteractionUpdatessync flush), which the issue did not ask for.gapMatch/GapNode.jsaimsAtGap) ships here, as a maintainer asked on [QTI] Emit update:interaction only when the built interaction content changes #6136.flush: 'sync'inQTIEditor/composables/useInteractionUpdates.js:16be the pattern for all seven editors? Each state mutation now emits as it happens, including during the parent's patch when thequestionTypeprop changes.Engineer evidence
Gap match now takes over every
insertTextwhose browser target range touches a gap, whatever the caret position (gapMatch/GapNode.js:134-137,313).QA review
Manual QA steps
QA team: question editors now save only real content changes. Associate and Match keep an edit made as a chip closes. Chip editors carry the most risk.
Requires: an exercise with each question type below. Open its Questions tab and click Edit on a question.
Look out for:
Captures (18)
Gap match distractors
gapmatch-distractors-save-delete-add.webm
Associate and Match chips
Chip toolbar, image dialog, keyboard
chip-menu-image-keyboard.webm
Other question types
s1-single-choice-edit-text-and-correct.webm
s2-choice-net-identical-then-real-edit-before-close.webm
AI usage
Claude Code wrote the watcher and specs; verified with the QTIEditor Jest suite.
Written by rtibblesbot, an LLM-based coding agent.
🟢 Updating PR
Last updated: 2026-11-20 11:16 UTC