diff options
Diffstat (limited to 'src/static/js')
-rw-r--r-- | src/static/js/client.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js index de90285c..46d66bcc 100644 --- a/src/static/js/client.js +++ b/src/static/js/client.js @@ -3588,10 +3588,15 @@ const sidebarSearchInfo = initInfo('sidebarSearchInfo', { session: { activeQuery: null, + activeQueryResults: null, + + repeatQueryOnReload: false, }, settings: { stoppedTyingDelay: 800, + + maxActiveResultsStorage: 100000, }, }); @@ -3672,12 +3677,17 @@ function initializeSidebarSearchState() { if (session.activeQuery) { info.searchInput.value = session.activeQuery; + } + + if (session.repeatQueryOnReload) { activateSidebarSearch(session.activeQuery); + } else if (session.activeQueryResults) { + showSidebarSearchResults(JSON.parse(session.activeQueryResults)); } } async function activateSidebarSearch(query) { - const {session, state} = sidebarSearchInfo; + const {session, settings, state} = sidebarSearchInfo; if (state.stoppedTypingTimeout) { clearTimeout(state.stoppedTypingTimeout); @@ -3688,6 +3698,11 @@ async function activateSidebarSearch(query) { session.activeQuery = query; + const stringifiedResults = JSON.stringify(results); + if (stringifiedResults.length < settings.maxActiveResultsStorage) { + session.activeQueryResults = JSON.stringify(results); + } + showSidebarSearchResults(results); } |