Skip to content

Commit afd34e8

Browse files
committed
Fix getBranchPoints accessor (#8695)
Regression from #8626. The branchpoints need to be a flat list so that the length can be compared to 0. - https://___.webknossos.xyz - create a new tree with node - press J - fixes https://discuss.webknossos.org/t/absence-of-jumps-in-annotations-is-not-detected/1930/2 ------ (Please delete unneeded items, merge only when none are left open) - [x] Updated [changelog](../blob/master/CHANGELOG.unreleased.md#unreleased)
1 parent cdfa6cf commit afd34e8

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1515
### Changed
1616

1717
### Fixed
18+
- Fixed a regression that led to incorrect behavior when trying to jump to the last branchpoint even though no branchpoint existed. [#8695](https://github.com/scalableminds/webknossos/pull/8695)
1819

1920
### Removed
2021

frontend/javascripts/viewer/model/accessors/skeletontracing_accessor.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,16 @@ export function getMaxNodeId(skeletonTracing: SkeletonTracing): number | null {
276276
);
277277
}
278278

279-
export function getBranchPoints(annotation: StoreAnnotation): IteratorObject<BranchPoint[]> | null {
279+
export function getBranchPoints(annotation: StoreAnnotation): BranchPoint[] | null {
280280
const skeletonTracing = getSkeletonTracing(annotation);
281281
if (skeletonTracing == null) {
282282
return null;
283283
}
284284

285-
return skeletonTracing.trees.values().map((tree) => tree.branchPoints);
285+
return skeletonTracing.trees
286+
.values()
287+
.flatMap((tree) => tree.branchPoints)
288+
.toArray();
286289
}
287290

288291
export function getFlatTreeGroups(

frontend/javascripts/viewer/model/sagas/skeletontracing_saga.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function* watchBranchPointDeletion(): Saga<void> {
126126

127127
if (deleteBranchpointAction) {
128128
const hasBranchPoints = yield* select(
129-
(state: WebknossosState) => (getBranchPoints(state.annotation)?.toArray() ?? []).length > 0,
129+
(state: WebknossosState) => (getBranchPoints(state.annotation) ?? []).length > 0,
130130
);
131131

132132
if (hasBranchPoints) {

0 commit comments

Comments
 (0)