Skip to content

v4.9.0 migration errors when course/components have no _tutor (_autoScrollWhenInline) #134

Closed

Description

@taylortom

Bug

The Tutor - 4.8.0 to 4.9.0 migration in migrations/v4.js throws when a course or component has no existing _tutor object:

TypeError: Cannot read properties of undefined (reading '_autoScrollWhenInline')

Cause

The mutate steps use _.set(course._tutor, '_autoScrollWhenInline', true) and _.set(component._tutor, '_autoScrollWhenInline', true). When _tutor is undefined, _.set is given an undefined target and silently no-ops, so the property is never written. The following checkContent steps then read course._tutor._autoScrollWhenInline / _tutor._autoScrollWhenInline off the still-undefined _tutor and throw.

The block's own testSuccessWhere fixtures hit this — { _type: 'course' } (no _tutor) and { _id: 'c-105', _component: 'mcq' } (no _tutor).

Unlike the earlier blocks in the same file (e.g. 4.0.0, 4.0.0 to 4.1.0), this block does not ensure _tutor exists before populating it.

Fix

Set via the parent with a dotted path so lodash creates the intermediate _tutor when missing (and preserves an existing one):

_.set(course, '_tutor._autoScrollWhenInline', true);
_.set(component, '_tutor._autoScrollWhenInline', true);

How this surfaced

Caught during an Adapt Authoring Tool course import, where the failed migration step now correctly aborts the import.

Activity

  1. moved this from New to Needs Reviewing in adapt_framework: The TODO Boardon Jul 7, 2026
  2. added theissue type on Jul 7, 2026
  3. moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Boardon Jul 26, 2026
  4. added a commit that references this issue on Jul 26, 2026
    def37e5
  5. github-actions commented on Jul 26, 2026

    @github-actions

    🎉 This issue has been resolved in version 4.10.1 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions