diff options
author | Aarni Koskela <akx@iki.fi> | 2023-07-31 09:23:26 +0000 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-07-31 09:23:26 +0000 |
commit | fb87a05fe8364c8871538355a8e24587c733a492 (patch) | |
tree | f2b55fb61877c4228c926a1f66d5828d1f83ab6b /javascript/ui.js | |
parent | a1eb49627af334f4f29d24f2c12c744b88b2d227 (diff) | |
download | stable-diffusion-webui-gfx803-fb87a05fe8364c8871538355a8e24587c733a492.tar.gz stable-diffusion-webui-gfx803-fb87a05fe8364c8871538355a8e24587c733a492.tar.bz2 stable-diffusion-webui-gfx803-fb87a05fe8364c8871538355a8e24587c733a492.zip |
Don't crash if out of local storage quota
Fixes #12206 (works around it)
Diffstat (limited to 'javascript/ui.js')
-rw-r--r-- | javascript/ui.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/javascript/ui.js b/javascript/ui.js index d70a681b..abf23a78 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -152,7 +152,11 @@ function submit() { showSubmitButtons('txt2img', false); var id = randomId(); - localStorage.setItem("txt2img_task_id", id); + try { + localStorage.setItem("txt2img_task_id", id); + } catch (e) { + console.warn(`Failed to save txt2img task id to localStorage: ${e}`); + } requestProgress(id, gradioApp().getElementById('txt2img_gallery_container'), gradioApp().getElementById('txt2img_gallery'), function() { showSubmitButtons('txt2img', true); @@ -171,7 +175,11 @@ function submit_img2img() { showSubmitButtons('img2img', false); var id = randomId(); - localStorage.setItem("img2img_task_id", id); + try { + localStorage.setItem("img2img_task_id", id); + } catch (e) { + console.warn(`Failed to save img2img task id to localStorage: ${e}`); + } requestProgress(id, gradioApp().getElementById('img2img_gallery_container'), gradioApp().getElementById('img2img_gallery'), function() { showSubmitButtons('img2img', true); @@ -191,8 +199,6 @@ function restoreProgressTxt2img() { showRestoreProgressButton("txt2img", false); var id = localStorage.getItem("txt2img_task_id"); - id = localStorage.getItem("txt2img_task_id"); - if (id) { requestProgress(id, gradioApp().getElementById('txt2img_gallery_container'), gradioApp().getElementById('txt2img_gallery'), function() { showSubmitButtons('txt2img', true); |