Skip to content

Fix: v4.9.0 migration handles missing _tutor#135

Open
taylortom wants to merge 1 commit into
masterfrom
fix/v4.9.0-migration-missing-tutor
Open

Fix: v4.9.0 migration handles missing _tutor#135
taylortom wants to merge 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants