shortkeys icon indicating copy to clipboard operation
shortkeys copied to clipboard

Upgrade lost settings, import caused breakage afterwards

Open pjeby opened this issue 2 years ago • 19 comments

Earlier this evening I saw a message on one of my computers about how Shortkeys is now running in the background and at system start. So I went to use one of its function keys to make sure everything was still working, and it didn't work. So I went to options and found my configuration empty - the upgrade deleted the configuration, it seems!

I went to a different computer -- same thing. Went to a laptop, pulled the network cable and woke it from sleep so I could export the settings from that machine before that copy's settings could be deleted, too.

I then imported the settings back onto other computers, but couldn't get anything to work. After a while, I noticed that there was an empty shortcut present above the imported items. After deleting the empty item and saving, I got things working again, at least on my main machine. (Haven't tested the others yet.)

tl;dr: Apparently, importing when you don't have any shortcuts (due to the upgrade deleting them) results in a blank shortcut above the imported shortcuts, which then appears to keep the rest from working correctly.

pjeby avatar Feb 14 '24 11:02 pjeby

Same here. and I noticed CSP error happened.

kokiito0926 avatar Feb 14 '24 12:02 kokiito0926

Same here. Thankfully I had exported my settings the other day so at least I have the config. But nothing is working even after reimporting them.

nerdgirl avatar Feb 14 '24 13:02 nerdgirl

Will publish a revert while I investigate!

crittermike avatar Feb 14 '24 14:02 crittermike

I just submitted a revert back to 4.0.2 but I have to wait for the webstore to review/publish it. All of your settings should still be there once that is published, as long as you didn't click submit on the settings form.

In the meantime, I'll investigate the issue.

(cc @fastndead in case you have any idea what could have caused this)

crittermike avatar Feb 14 '24 15:02 crittermike

Very sorry so hear the about the issues with the manifest v3 update :(

@crittermike i see the issue is that with manifest v3 we changed configs storage for the keys from local storage to the chrome.storage.local API, and haven't implemented a smooth migration between them. I will have to think about how to do that without having users manually reimport their configs.

the issue with imports is a strange one, i will have to look into it.

thanks @crittermike for reverting back to 4.0.2

fastndead avatar Feb 14 '24 20:02 fastndead

[...] we changed configs storage for the keys from local storage [...]

Thank you so much for pointing this out, I was able to go check the local storage using DevTools and recover my configuration. Saves me the hassle of re-writing all the JavaScript (which I had also not saved anywhere) for the shortkeys I had which were just running those in the browser console.

w4tchdoge avatar Feb 14 '24 21:02 w4tchdoge

No worries @fastndead! You're a champ - this is on me for somehow missing it in my regression testing.

crittermike avatar Feb 14 '24 21:02 crittermike

Just wanted to add that if you go to the extensions options page and open up dev tools you can get your old data by running copy(JSON.stringify(JSON.parse(localStorage.shortkeys).keys, null, 2)) which will copy the config to your clipboard. Then you should be able to paste this into import to get back up.

malkomalko avatar Feb 14 '24 22:02 malkomalko

I note here because I saw a way to port the previous localStorage to read chrome.storage. chrome.storage  |  API  |  Chrome for Developers

oniatsu avatar Feb 15 '24 01:02 oniatsu

Today my javascripts of Shortkey are also lost. After importing them again (yes, I have a backup ;-)), they do not work. And I get this message:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'toLowerCase') at Object.activateKey (content.js:1:6082) at content.js:1:6484 at Array.forEach (<anonymous>) at content.js:1:6469

Has this something to do with this "bug"?

webaschtl avatar Feb 16 '24 10:02 webaschtl

Check if you have a blank entry in your list of shortcuts, and if so, delete it. I don't know if that's the problem you're having, as I never checked the console, but if there's a blank shortcut in the list then none of them will work. And if you imported after the upgrade and never deleted the blank shortcut created by the upgrade, then you probably need to delete it.

pjeby avatar Feb 16 '24 11:02 pjeby

Just wanted to add that if you go to the extensions options page and open up dev tools you can get your old data by running copy(JSON.stringify(JSON.parse(localStorage.shortkeys).keys, null, 2)) which will copy the config to your clipboard. Then you should be able to paste this into import to get back up.

Thank you @malkomalko, I was able to import the copied shortcuts.

hababr avatar Feb 16 '24 17:02 hababr

Hi all, quick update, the reverted package keeps getting rejected by the webstore team for annoying reasons. I just submitted the 3rd attempt - hopefully that one goes through.

crittermike avatar Feb 16 '24 18:02 crittermike

Check if you have a blank entry in your list of shortcuts, and if so, delete it. I don't know if that's the problem you're having, as I never checked the console, but if there's a blank shortcut in the list then none of them will work. And if you imported after the upgrade and never deleted the blank shortcut created by the upgrade, then you probably need to delete it.

Hm, I still do not know the cause. There was no blank entry. On my second PC the shortcuts had also gone. But with the tip in this thread (https://github.com/crittermike/shortkeys/issues/598#issuecomment-1944845929) to restore the "old" data, the Shortkeys now working again.

webaschtl avatar Feb 16 '24 21:02 webaschtl

Just wanted to add that if you go to the extensions options page and open up dev tools you can get your old data by running copy(JSON.stringify(JSON.parse(localStorage.shortkeys).keys, null, 2)) which will copy the config to your clipboard. Then you should be able to paste this into import to get back up.

Forgive my naivety, but where do I run this? I tried the developer console but got a syntax error.

@crittermike any update from the webstore?

dannypernik avatar Feb 21 '24 07:02 dannypernik

@dannypernik Dev console from options page.

hababr avatar Feb 21 '24 07:02 hababr

@dannypernik the revert should be posted now - 4.1.2. I've heard from others that that fixed things for them. No luck from your end?

crittermike avatar Feb 21 '24 15:02 crittermike

@crittermike I confirmed that version 4.1.2 is active, but former shortcuts are not displaying. They weren't the most sophisticated or numerous shortcuts (yet) so I'm fine to recreate them if necessary.

@hababr here's what I'm seeing: image

dannypernik avatar Feb 21 '24 19:02 dannypernik

@crittermike following up here. I added a few of my shortcuts back to my blank options but never got my old ones back.

dannypernik avatar Mar 06 '24 15:03 dannypernik