Skip to content
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

Update PatchOrdering.kt #2679

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,12 @@ internal object PatchOrdering {
private fun PatchMapping.findOutgoingReferences(
localChangeIdToReferenceMap: Map<Long, List<LocalChangeResourceReference>>,
): Set<Node> {
if (generatedPatch.type == Patch.Type.DELETE) return emptySet()
GeorgCantor marked this conversation as resolved.
Show resolved Hide resolved
val references = mutableSetOf<Node>()
when (generatedPatch.type) {
Patch.Type.INSERT,
Patch.Type.UPDATE, -> {
localChanges.forEach { localChange ->
localChange.token.ids.forEach { id ->
localChangeIdToReferenceMap[id]?.let {
references.addAll(it.map { it.resourceReferenceValue })
}
}
}
}
Patch.Type.DELETE -> {
// do nothing
}
localChanges.forEach { localChange ->
localChange.token.ids.flatMap { id ->
localChangeIdToReferenceMap[id]?.map { it.resourceReferenceValue } ?: emptyList()
}.let { references.addAll(it) }
GeorgCantor marked this conversation as resolved.
Show resolved Hide resolved
}
return references
}
Expand Down