-
Notifications
You must be signed in to change notification settings - Fork 377
How to Debug Database Issue
For historical reason, Stylus uses two databases to store your data. When one is down, it switches to the other one automatically. When this happens, you will find that all your styles disappeared.
-
Open the style manager
-
Open the devtool by pressing F12
-
Switch to the
Consoletab -
Copy-paste following commands and press Enter (Chrome or Firefox 64+):
console.log( localStorage.dbInChromeStorage, await chromeLocal.get(["dbInChromeStorage", "dbInChromeStorageReason"]) );
-
If it says
truethen you are usingchromeStorageDB, it may also come with a reason.If it says
falsethen you are usingindexedDB.
- Open the style manager
- Open the devtool console by pressing F12
- Switch to the
Applicationtab - At the left panel, expand
IndexedDB>stylish>styles
If the database contains data:
- Open the style manager
- Open the storage panel by pressing Shift> + F9
- At the left panel, expand
Indexed DB>moz-extension://...>stylish (default)>styles
If the database contains data:
-
Open the style manager
-
Open the devtool console by pressing F12
-
Switch to the
Consoletab -
Copy-paste the following command and press Enter:
(async () => { const result = await chromeLocal.get(); const output = []; for (const key in result) { if (key.startsWith("style-")) { output.push(result[key]); } } console.log(output); })();
If the database contains data:
Sometimes your data are still there but you can't see them because the wrong database is activated. In this case, you just have to switch the database.
-
Open the style manager
-
Open the devtool by pressing F12
-
Switch to the
Consoletab -
Copy-paste the command and press Enter:
-
Switch to IndexedDB:
localStorage.dbInChromeStorage = "false"; await chromeLocal.set({ "dbInChromeStorage": false });
-
Switch to chromeStorageDB:
localStorage.dbInChromeStorage = "true"; await chromeLocal.set({ "dbInChromeStorage": true, "dbInChromeStorageReason": "switched manually" });
-
-
Restart the browser