Repository navigation
fix(ProjectService): Empty lesson that transitions to itself overflows the stack - #2349
Merged
hirokiterashima merged 1 commit intoOct 21, 2026
Conversation
…s the stack getLessonPaths() followed an empty lesson's transitions without checking the path so far, so a lesson that transitions to itself recursed until the stack overflowed. Parsing runs whenever a unit is opened for authoring or preview, so one bad transition made the whole unit unopenable, including the authoring view needed to repair it. Steps already end the path on a loop; do the same for empty lessons.
Member
|
🎉 This PR is included in version 5.248.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
getLessonPaths()handles an empty lesson (nostartId) by following the lesson's own transitions, and it does so without checkingpathSoFar. A lesson whose transition points back to a lesson already on the path, including itself, therefore recurses untilRangeError: Maximum call stack size exceeded.getStepPaths()already handles this case: whenpathSoFarcontains the target it ends the path instead of following the transition. Empty lessons were the one path without that check.Because
parseProject()callsgetAllPaths()throughgetBranches(), the error is thrown whenever the unit is loaded, for authoring and for preview alike. One bad transition makes the whole unit unopenable, including the authoring view that would be needed to fix it. The only remaining options are the recovery view or editingproject.jsonon disk.A self-transition like this is what pressing Enter in the add lesson view currently produces; #2348 fixes that cause. This PR makes units already saved in that state open again, so the extra lesson can be deleted in the authoring tool.
Changes
getLessonPaths(), a transition whose target is already inpathSoFarends the path at the lesson, matchinggetStepPaths().Test
projectService.spec.tsundergetAllPaths(): an empty lesson that transitions to itself yields['node1', 'node2', 'group3']. Against the currentdevelop, it fails withRangeError: Maximum call stack size exceeded.