NIAGADS / niagads-igv-webapp

Standalone webapp for NIAGADS customized IGV Genome Browser
GNU General Public License v3.0
1 stars 1 forks source link

save genome browser session to the web browser storage #37

Open fossilfriend opened 1 year ago

fossilfriend commented 1 year ago

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:

  1. browsing away and back in same tab? --> restore session
  2. refreshing page --> restore session
  3. closing tab or browser --> do we want to restore session or not? NO
  4. reopen (accidentally) closed tab --> can we restore the session?

how best to do this? localStorage vs sessionStorage 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?

fossilfriend commented 12 months 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

fossilfriend commented 12 months ago

sessionJSON will need to updated when

create a single callback for all the events

onBrowserChange -> regenerates sessionJSON

sessionStorage should then be updated by a useEffect hook dependent on sessionJSON

fossilfriend commented 12 months ago

for adding/loading a new track

for removing a track

fossilfriend commented 12 months ago

for handling changes to region on interests

add a useEffect hook that looks for changes to browser.roiManager.roiSets

simoncole commented 12 months ago

Implemented saving, loading, adding, and removing tracks that persist with the session.

simoncole commented 11 months ago

Saving ROIs

Current Implementation

simoncole commented 11 months ago

Saving Locus changes to the session

simoncole commented 11 months ago

Summary