Skip to content

fix: peer edge crash due to no parent or detached node #8448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: latest
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ This is a one-time fix-up, please be patient...
// virtual root is based on the root project, and allow non-peer parent
// deps to override, but throw if no preference can be determined.
async #loadPeerSet (node, required) {
const parent = node.parent
const peerEdges = [...node.edgesOut.values()]
// we typically only install non-optional peers, but we have to
// factor them into the peerSet so that we can avoid conflicts
Expand All @@ -1311,8 +1312,8 @@ This is a one-time fix-up, please be patient...
continue
}

const parentEdge = node.parent.edgesOut.get(edge.name)
const { isProjectRoot, isWorkspace } = node.parent.sourceReference
const parentEdge = parent.edgesOut.get(edge.name)
const { isProjectRoot, isWorkspace } = parent.sourceReference
const isMine = isProjectRoot || isWorkspace
const conflictOK = this.options.force || !isMine && !this.#strictPeerDeps

Expand Down
Loading