Skip to content

Fix: v4.9.0 migration handles missing _tutor - #135

Merged
swashbuck merged 1 commit into
masterfrom
fix/v4.9.0-migration-missing-tutor
Jul 26, 2026
Merged

swashbuck merged 1 commit into
masterfrom
fix/v4.9.0-migration-missing-tutor

Conversation

@taylortom

Copy link
Copy Markdown
Member

Fixes #134

Fix

  • The Tutor - 4.8.0 to 4.9.0 migration in migrations/v4.js used _.set(course._tutor, '_autoScrollWhenInline', true) and _.set(component._tutor, '_autoScrollWhenInline', true). When _tutor is undefined, _.set no-ops (the target is undefined), so the property is never written and the following checkContent steps throw Cannot read properties of undefined (reading '_autoScrollWhenInline').
  • 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)

Testing

  • The block's existing testSuccessWhere fixtures cover the previously failing paths — { _type: 'course' } (no _tutor) and { _id: 'c-105', _component: 'mcq' } (no _tutor) — and now pass.
  • Verified lodash behaviour: dotted-path _.set creates _tutor when absent and leaves an existing _tutor (e.g. { _type: 'notify' }) intact.

The 4.8.0 to 4.9.0 migration used _.set(course._tutor, ...) /
_.set(component._tutor, ...), which no-ops when _tutor is undefined,
leaving the property unset so the checkContent steps threw
'Cannot read properties of undefined (reading _autoScrollWhenInline)'.

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

@swashbuck swashbuck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@swashbuck
swashbuck merged commit 829a621 into master Jul 26, 2026
1 check passed
@swashbuck
swashbuck deleted the fix/v4.9.0-migration-missing-tutor branch July 26, 2026 20:29
@github-project-automation github-project-automation Bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Jul 26, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants