Skip to content

Commit dee542e

Browse files
Fix: select feature when we create new feature from JBrowse track (#718)
1 parent c5153ef commit dee542e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/jbrowse-plugin-apollo/src/components/CreateApolloAnnotation.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ export function CreateApolloAnnotation({
370370
})
371371
}
372372

373-
await submitChange(change)
373+
await submitChange(change, annotationFeature._id)
374374
}
375375

376376
const copyTranscriptsToDestinationGene = async (
@@ -397,7 +397,8 @@ export function CreateApolloAnnotation({
397397
assembly: assembly.name,
398398
addedFeature: transcript,
399399
})
400-
await submitChange(change)
400+
// selects the last added transcript
401+
await submitChange(change, transcriptId)
401402
}
402403
}
403404

@@ -425,8 +426,7 @@ export function CreateApolloAnnotation({
425426
},
426427
},
427428
})
428-
await submitChange(change)
429-
apolloSessionModel.apolloSetSelectedFeature(newGeneId)
429+
await submitChange(change, newGeneId)
430430
}
431431

432432
const extendSelectedDestinationFeatureLocation = async (
@@ -468,8 +468,14 @@ export function CreateApolloAnnotation({
468468

469469
const submitChange = async (
470470
change: AddFeatureChange | LocationStartChange | LocationEndChange,
471+
selectedFeatureId?: string,
471472
) => {
472-
await apolloSessionModel.apolloDataStore.changeManager.submit(change)
473+
await apolloSessionModel.apolloDataStore.changeManager
474+
.submit(change)
475+
.then(() => {
476+
// Selects the newly added/modified feature
477+
apolloSessionModel.apolloSetSelectedFeature(selectedFeatureId)
478+
})
473479
}
474480

475481
const handleCreateNewGeneChange = (

0 commit comments

Comments
 (0)