-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #213885, As much as possible flush the storage in beforeunload callback #213896
Conversation
…ge service flush when triggered by beforeunload
From what I know working in this area, there is no way to make |
My original intention is to ensure that the I would like to paste the comparison of the effect before and after I modified these lines of code to let you know my purpose: However, you mentioned that the browser does not guarantee that the asynchronous callback function can be executed. Indeed, I did not notice this problem before. I want to think again. |
…icrosoft#213902) * On request-removal undo till the point at which the request was made fixes https://github.com/microsoft/vscode-copilot/issues/5736 * fixed EOL sequence which (hopefully) fixes tests * give up, don't use new lines...
Check minor bash version before using @p
Workaround low underscore in fonts by adjusting line height
…ge service flush when triggered by beforeunload
…ge service flush when triggered by beforeunload
hi @bpasero I have some new progress:
|
Inspired by this article: https://dev.to/chromiumdev/sure-you-want-to-leavebrowser-beforeunload-event-4eg5 |
I doubt it will work, there is no async way to prevent the unload. I am not sure what this PR is trying to solve. |
Yes, In fact, it is no longer an asynchronous function blocking the browser. I just changed the title. The current strategy is that if you need to flush storage before the page unload, you will call up the confirmation box as much as possible. Although there is no guarantee that the flush task will be completed, there is a chance, just like your previous code. |
We explicitly do not want to block the unload only for that reason because it is very annoying and there is not even a way to tell the user what is going on. Instead, we periodically flush storage time based and also when focus changes. Sorry, but I think there is not a lot we can do here unless browser vendors give in and allow for more control what happens on unload. |
Thank you very much! I see what you mean. Then I would also like to ask other question, at the time when I operate vscode (for example close the panel or open some files) I refresh the page directly, some states may not be saved. Do you have any good suggestions for solving this problem? |
I actually do not, but I am happy for suggestions that do not force a modal dialog on people 🙏 |
This should be fixed now. |
Fix #213885