Fix: v4.9.0 migration handles missing _tutor#135
Open
taylortom wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #134
Fix
Tutor - 4.8.0 to 4.9.0migration inmigrations/v4.jsused_.set(course._tutor, '_autoScrollWhenInline', true)and_.set(component._tutor, '_autoScrollWhenInline', true). When_tutorisundefined,_.setno-ops (the target isundefined), so the property is never written and the followingcheckContentsteps throwCannot read properties of undefined (reading '_autoScrollWhenInline')._tutorwhen missing and preserves an existing one:_.set(course, '_tutor._autoScrollWhenInline', true)_.set(component, '_tutor._autoScrollWhenInline', true)Testing
testSuccessWherefixtures cover the previously failing paths —{ _type: 'course' }(no_tutor) and{ _id: 'c-105', _component: 'mcq' }(no_tutor) — and now pass._.setcreates_tutorwhen absent and leaves an existing_tutor(e.g.{ _type: 'notify' }) intact.