Skip to content

Commit

Permalink
Use a hacky workaround for cleaning feature cache
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 31, 2018
1 parent d085660 commit a771528
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/JBrowse/View/Track/Alignments2.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ return declare( [ CanvasFeatureTrack, AlignmentsMixin ], {
},

fillBlock: function( args ) {

// workaround for the fact that initial load of JBrowse invokes fillBlock on nonsense regions
// and then the cache cleanup can be invoked in ways that destroys visible features
this.removeFeaturesFromCacheAfterDelay = this.removeFeaturesFromCacheAfterDelay || false
setTimeout(() => {
this.removeFeaturesFromCacheAfterDelay = true
}, 30000)
if(this.config.viewAsPairs) {
let supermethod = this.getInherited(arguments)
var reg = this.browser.view.visibleRegion()
Expand All @@ -187,12 +194,12 @@ return declare( [ CanvasFeatureTrack, AlignmentsMixin ], {
})
}
this.fetchMap[str].then(() => {
let f = args.finishCallback
args.finishCallback = () => {
f()
setTimeout(() =>
this.store.cleanFeatureCache({ ref: this.refSeq.name, start: min, end: max }),
1000)
if(this.removeFeaturesFromCacheAfterDelay) {
let f = args.finishCallback
args.finishCallback = () => {
f()
this.store.cleanFeatureCache({ ref: this.refSeq.name, start: min, end: max })
}
}
supermethod.call(this, args)
})
Expand Down

0 comments on commit a771528

Please sign in to comment.