-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Warn in DevTools before clearing localStorage #772
Comments
Just ran into this. A warning would be a good addition. |
@michaeljonsampson curious.. which part of storage was cleared that you were surprised by? We actually keep cookies alone, but it's possible you were using localStorage for similar purposes. :/ |
IndexedDB data was deleted. |
Let's stop clearing idb and localstorage. Leave it to the user to clear that themselves. |
If we do this, I think we should detect if the site has something in idb or localstorage and issue a top-level warning that it should be manually cleared if it might impact loading time. e.g. predownloaded or precomputed assets (like compiled wasm modules). It would be easy to forget to clear between lighthouse runs and have no idea why your score changed so much, especially if the caching is done by a library and without code written by the developer themselves. |
@AdityaAnand1 it's behind the "Settings" cog in the top right now. |
If it's hidden behind a cog, it's no longer signaling to user that it's going to clear storage. For context, in my case I'm storing documents for a drawing program in IndexedDB via localforage. |
Yeah a fair point @1j01! Feel free to star the Chromium issue to add a warning (https://bugs.chromium.org/p/chromium/issues/detail?id=806488) |
proposal:
|
@connorjclark can you capture here what you were proposing for this? |
just this
we should do this for other things too. a list of warnings below "Generate Report" sayings things like, FYI: We noticed local overrides, we noticed data in storage, we noticed blocked requests, just FYI in case this wasn't intentional. |
Reading this DevTools use of Chrome Profiles doc, can we avoid having to make these assumptions and reduce magic if we open an incognito-ish new window when "Clear storage" is checked, and reuse the tab when it isn't checked? Right now (from the doc) it looks like you can do I assume this would be more straightforward to do in the DevTools side of things than in Lighthouse core, but I wonder if it would make anything in interoperation with |
Please deselect "Clear storage" by default or at least show me a prompt that tells me you're going to wipe out my DB. |
@brendankenny looks like the ephemeral profiles idea was scrapped. I think adding a warning is the best option for now. |
This is a basic solution I came up with. Currently checks for localstorage/idb/websql via I'm temporarily using the "unauditable" error text. Looks like there are a couple ways we could display the warning:
I'm currently in favor of just the confirmation prompt for now but I'm willing to hear others' thoughts. |
That would be interesting! But with an additional feature of "Never remind me again" (we could add it to the settings cog, I guess). Other warnings we might want in this list:
|
This is a pretty bad experience. I lost a lot of data by not knowing that running a lighthouse report will clear it. I took a backup of that data in one of my other website, but apparently I ran lighthouse on that too, so now I lost it forever. |
Lighthouse users are sometimes unaware that auditing a page can clear potentially important resources: GoogleChrome/lighthouse#772 Lighthouse will no longer clear resources in IndexedDB, WebSQL, or local storage when auditing a page. Since that change may affect performance scores, Lighthouse will display a top level warning in the report when data was found in any of those three locations. The warning tells the user they should audit in an incognito window. This CL adds an additional warning to the Lighthouse DevTools panel which conveys the same information. Preview: https://imgur.com/nN1ZfFR Bug: 806488 Change-Id: I64fd9e197868f690af0e0b89de52e0b7baa3f1fa Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2385182 Commit-Queue: Adam Raine <asraine@google.com> Reviewed-by: Connor Clark <cjamcl@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Lighthouse users are sometimes unaware that auditing a page can clear potentially important resources: GoogleChrome/lighthouse#772 Lighthouse will no longer clear resources in IndexedDB, WebSQL, or local storage when auditing a page. Since that change may affect performance scores, Lighthouse will display a top level warning in the report when data was found in any of those three locations. The warning tells the user they should audit in an incognito window. This CL adds an additional warning to the Lighthouse DevTools panel which conveys the same information. Preview: https://imgur.com/nN1ZfFR Bug: 806488 Change-Id: I64fd9e197868f690af0e0b89de52e0b7baa3f1fa Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2385182 Commit-Queue: Adam Raine <asraine@google.com> Reviewed-by: Connor Clark <cjamcl@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org>
@adamraine has taken care of us here 🎉 |
I tried out the lighthouse Chrome extension and it wiped out my IndexedDB etc. without any indication that it was going to do so. I can see why it would, but this deleted a lot of data that could have been important. So it should mention that.
The text was updated successfully, but these errors were encountered: