Commit ac133ff1 authored by Robert Knight's avatar Robert Knight

Simplify a conditional

Test `isFirstLoad` once instead of in each branch. This makes it more
obvious that a group is only ever focused on first load.
parent 85e6df6e
......@@ -290,15 +290,14 @@ function groups(
store.loadGroups(groups);
if (
isFirstLoad &&
groups.some(g => g.id === directLinkedAnnotationGroupId)
) {
store.focusGroup(directLinkedAnnotationGroupId);
} else if (isFirstLoad && groups.some(g => g.id === directLinkedGroupId)) {
store.focusGroup(directLinkedGroupId);
} else if (isFirstLoad && groups.some(g => g.id === prevFocusedGroup)) {
store.focusGroup(prevFocusedGroup);
if (isFirstLoad) {
if (groups.some(g => g.id === directLinkedAnnotationGroupId)) {
store.focusGroup(directLinkedAnnotationGroupId);
} else if (groups.some(g => g.id === directLinkedGroupId)) {
store.focusGroup(directLinkedGroupId);
} else if (groups.some(g => g.id === prevFocusedGroup)) {
store.focusGroup(prevFocusedGroup);
}
}
return groups;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment