cfahlgren1 / hf-data-explorer

Chrome Extension for exploring Hugging Face datasets 🔎
https://chromewebstore.google.com/detail/hugging-face-datasets-exp/algkmpgdgbindfpddilldlogcbhpkhhd
23 stars 1 forks source link

bug: Extension Context Invalidated #19

Closed cfahlgren1 closed 6 days ago

cfahlgren1 commented 6 days ago

Sometimes the extension can become invalidated causing issues. We can leverage the onDisconnect handler in the chrome.runtime API.

The solution is to reinject the content scripts into the page

browser.runtime.connect().onDisconnect.addListener(function() {
    // clean up when content script gets disconnected
})

https://stackoverflow.com/questions/10994324/chrome-extension-content-script-re-injection-after-upgrade-or-install/11598753#11598753

cfahlgren1 commented 6 days ago

We also need to ensure that the views loading in local storage is set in the content script not the popup so user can load after installing without having ever opened the popup.

cfahlgren1 commented 6 days ago

You can reproduce this manually by reloading the extension with Extension Reloader and then trying to close the explorer

image