Skip to content

[RTE] Emit update:interaction only when the built interaction content changes #6136

Description

@rtibblesbot

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Three QTI interaction editors emit update:interaction when they mount or switch into edit mode, even though nothing has changed. AssociateInteractionEditor.vue was changed in #6113 to emit only on a real content change; the others still push a rebuilt interaction block at the parent just for being opened.

Complexity: Low
Target branch: unstable

Context

  • ChoiceInteractionEditor.vue:382{ immediate: true }, no mode gate: emits on mount in any mode.
  • OrderingInteractionEditor.vue:309 — the props.mode watcher emits on entering edit mode.
  • TextEntryEditor.vue:338-350{ immediate: true }; gated on edit mode, still emits on mount.
  • All three watch a computed that rebuilds a fresh object on every state change, so an edit producing identical XML still emits.
  • AssociateInteractionEditor.vue is the reference shape after Add the QTI associate interaction plugin #6113.

The Change

  • Each editor should emit update:interaction only in edit mode, and only when the rebuilt bodyXml / responseDeclarations differ by value from what it last emitted.
  • Opening an editor, switching mode, or retyping identical content should produce no emit.

Acceptance Criteria

  • Choice, ordering, and text entry editors do not emit update:interaction on mount.
  • None of the three emit when mode changes without a content change.
  • None of the three emit when a state change rebuilds identical bodyXml and responseDeclarations.
  • Each still emits after an edit that changes the built XML.
  • Specs asserting emit-on-mount are updated, and the no-emit cases are covered by new tests.

AI usage

Written by Claude Code while addressing review feedback on #6113. The reviewer asked for this emit behaviour on the associate editor; I grepped the other interaction editors for the same pattern, confirmed each line reference above by reading the code, and filed this rather than widening that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions