restore the progress from session lost / tab reload
Describe what this pull request is trying to achieve.
This PR attempts to restore the progress bar from session lost / tab reload
Environment this was tested in
- OS: Ubuntu 22.04
- Browser: Firefox 109.0.1 (64bit)
Screenshots or videos of your changes
https://user-images.githubusercontent.com/772892/216965025-0b6b284d-1ef9-460a-93b3-b34a09887fc5.mp4
@siutin could you please resolve the conflicts so auto will be, in theory, able to review it?
my problems with it:
- this allows you to "restore" other users' generations.
- considering (1), preventing img2img showing up in text2img seems not to be really necessary, and I don't want to add stuff to task ids just for that
- it's a fairly uncommon thing to do for user and it takes half the space away from the most useful button in the whole program
- That would require multiple user support. I'm not quite familiar with it, but I could have a look.
- This PR can restore progress for both txt2img and img2img. Therefore I'm not quite sure I understand this, maybe I'm missing something here?
- I can try making the button smaller or explore other options. Do you have any preferences on this?
my problems with it:
- this allows you to "restore" other users' generations.
- considering (1), preventing img2img showing up in text2img seems not to be really necessary, and I don't want to add stuff to task ids just for that
- it's a fairly uncommon thing to do for user and it takes half the space away from the most useful button in the whole program
1 - how about saving task id locally in the browser (js localstorage) and using that to restore the session
2 - I'd like to not add any changes to task ids for simplicity and if the side effect of that is that you can load img2img results in text2img tab, that's not a problem
3 - well, how about a button below generate along with other buttons in that row.
As an extra together with (1) the button can be made only visible if the task id is stored locally and not visible otherwise, and local task id would be emptied after a generation finishes so the button would normally be hidden. this is getting fairly complex considering user can have multiple tabs open so maybe this extra can be dumped...
- It seems like back-end support would be a more appropriate way on this ...
- Okay
- No problem
I've made some changes based on the feedback I received. For (1), I updated the Task API to be user-specific when authentication is enabled. This means that users won't be able to restore someone else's work unless they have the exact task ID. I hope this addresses the concern.

I ended up doing an independent implementation that tracks task id in browser locally and uses that to restore, showing the button only if the task id exists for a task that wasn't finished properly in the client.