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.
Bug
The
Tutor - 4.8.0 to 4.9.0migration inmigrations/v4.jsthrows when a course or component has no existing_tutorobject:Cause
The mutate steps use
_.set(course._tutor, '_autoScrollWhenInline', true)and_.set(component._tutor, '_autoScrollWhenInline', true). When_tutorisundefined,_.setis given anundefinedtarget and silently no-ops, so the property is never written. The followingcheckContentsteps then readcourse._tutor._autoScrollWhenInline/_tutor._autoScrollWhenInlineoff the still-undefined_tutorand throw.The block's own
testSuccessWherefixtures 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_tutorexists before populating it.Fix
Set via the parent with a dotted path so lodash creates the intermediate
_tutorwhen missing (and preserves an existing one):How this surfaced
Caught during an Adapt Authoring Tool course import, where the failed migration step now correctly aborts the import.