Internal fix: make expandPath not assume path has associated sweep (#4386)

* Add a test that shows current error within `expandPath`

* Make `expandPath` not assume there is an associated sweep artifact

* Look at this (photo)Graph *in the voice of Nickelback*

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2024-11-05 21:32:05 -08:00
committed by GitHub
parent 7bad60dfa3
commit 984420c155
3 changed files with 103 additions and 11 deletions

View File

@ -36,9 +36,12 @@ interface solid2D {
}
export interface PathArtifactRich {
type: 'path'
/** A path must always lie on a plane */
plane: PlaneArtifact | WallArtifact
/** A path must always contain 0 or more segments */
segments: Array<SegmentArtifact>
sweep: SweepArtifact
/** A path may not result in a sweep artifact */
sweep?: SweepArtifact
codeRef: CommonCommandProperties
}
@ -587,13 +590,15 @@ export function expandPath(
{ keys: path.segIds, types: ['segment'] },
artifactGraph
)
const sweep = getArtifactOfTypes(
{
key: path.sweepId,
types: ['sweep'],
},
artifactGraph
)
const sweep = path.sweepId
? getArtifactOfTypes(
{
key: path.sweepId,
types: ['sweep'],
},
artifactGraph
)
: undefined
const plane = getArtifactOfTypes(
{ key: path.planeId, types: ['plane', 'wall'] },
artifactGraph