NAL-i5K / genomics-workspace

Django website project for common sequence search tools.
http://genomics-workspace.readthedocs.io/
Other
17 stars 5 forks source link

[BLAST app] Storage, from results page back to submission page #273

Closed r06942072 closed 5 years ago

r06942072 commented 5 years ago

from results page back to submission page We want the state still preserve.

r06942072 commented 5 years ago

Ref:

r06942072 commented 5 years ago

legacy BLAST looks like using a sessionStorage, but "localStorage + popupbox" is better if the user accidentially close the window during working.

Ref:

r06942072 commented 5 years ago

related issue on gitlab:

r06942072 commented 5 years ago

Write localStorage in redux store Ref link: https://stackoverflow.com/questions/35305661/where-to-write-to-localstorage-in-a-redux-app https://egghead.io/lessons/javascript-redux-persisting-the-state-to-the-local-storage https://www.taniarascia.com/how-to-use-local-storage-with-javascript/

r06942072 commented 5 years ago

keyword: window.localStorage

step1. store.subscribe(localStorage.setItem(.....)) add localStorage code in store subscribe(listener), whenever the reduxstate change, save the latest reduxstate in the localStorage as the datatype string and as a variable named 'reduxState' 0724_step1_localStorage_setitem

step2. (localStorage.getItem(.....)) If the localStorage is not empty, then load initial state from it 0724_step2

step3. fetchList() is defined in actions/ If the localStorage is empty(which means that the user open the BLAST form the very first time), fetch the data from remote url 0724_fetchdata_step3

r06942072 commented 5 years ago

FYI, on chrome browser

localStorage localStorage

localStorage.clear() if want to clear it to null