Open fossilfriend opened 1 year ago
Decided to proceed w/sessionStorage
and leverage https://usehooks.com/
Will also leverage sessionJSON
object created when user saves
(exports
) the IGV session as JSON
So, saving & loading sessionJSON
(via buttons) is a prerequiste to completing this task
sessionJSON
will need to updated whenonBrowserChange
-> regenerates sessionJSON
sessionStorage
should then be updated by a useEffect
hook dependent on sessionJSON
alter loadTracks
function
add a parameter onTrackLoad
that expects a callback as a value (so can add .then(onTrackLoad()
to the browser.loadTrack()
call)
when loadTrack
is called from IGVBrowser
component, pass onBrowserChange
as the callback value
browser.on('trackremoved', function (track: any) { onBrowserChange()})
inside the createBrowser
calladd a useEffect
hook that looks for changes to browser.roiManager.roiSets
Save the "session" to the (global) state, so that when user browsers away from the page or refreshes the page, the current view (location, highlights, selected tracks) is remembered.
User experience:
how best to do this?
localStorage
vssessionStorage
see: https://www.geeksforgeeks.org/difference-between-local-storage-session-storage-and-cookies/# and: https://www.digitalocean.com/community/tutorials/js-introduction-localstorage-sessionstorage and also: https://blog.logrocket.com/using-localstorage-react-hooks/ and https://usehooks.com/and then what do we want to store?