Skip to content
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

Clearing cache & block sync state #207

Closed
grod220 opened this issue Oct 3, 2024 · 4 comments · Fixed by #217
Closed

Clearing cache & block sync state #207

grod220 opened this issue Oct 3, 2024 · 4 comments · Fixed by #217
Assignees
Labels
bug Something isn't working

Comments

@grod220
Copy link
Contributor

grod220 commented Oct 3, 2024

When clearing cache, the last block synced status does not clear until a new block is synced. This can cause feelings of unresponsiveness. In case of mainnet, genesis state sync can take some time so it accentuate this feeling. Example:

compressed.mov

Likely need to explicitly reset the chrome.storage.local value for lastBlockSynced when issuing a cache clear action.

@grod220 grod220 added the bug Something isn't working label Oct 3, 2024
@github-project-automation github-project-automation bot moved this to 🗄️ Backlog in Labs web Oct 3, 2024
@grod220 grod220 moved this from 🗄️ Backlog to 📝 Todo in Labs web Oct 3, 2024
@TalDerei
Copy link
Contributor

TalDerei commented Oct 14, 2024

duplicate of penumbra-zone/web#1496.

previous offline discussions suggest the fix may be more involved, but I will investigate.

@TalDerei
Copy link
Contributor

TalDerei commented Oct 14, 2024

chrome.runtime.reload() restarts the extension by terminating and reloading the background service worker and injected content scripts. Immediately after reloading the webpage, it causes a redirect to the "Connect to Penumbra" page (see example in penumbra-zone/web#1496). As L pointed out, restarting the background worker breaks the injected content scripts, and the constrained single-threaded service worker blocks the listeners responsible for initializing the content scripts.

Wouldn't refactoring the service worker lifecycle automatically resolve this issue as a side-effect? The only additional modification would be to the promise in the message listener by updating it with:
await Promise.allSettled([localExtStorage.remove('params'), indexedDb.clear(), chrome.storage.local.remove('fullSyncHeight')]);

I think if we want to tackle this in isolation, we’d need to ensure that the wallet connection status, which is handled by a content script, persists during chrome.runtime.reload(). We can save the connection status in persistent storage, chrome.storage.local. And when the extension and content scripts are reloaded, we can restore the wallet connection status from there?

@grod220
Copy link
Contributor Author

grod220 commented Oct 15, 2024

Yes, I think that allSettled() line would resolve the issue and can be done now

@TalDerei
Copy link
Contributor

Yes, I think that allSettled() line would resolve the issue and can be done now

even with that line, it will immediately display a "data objects could not be cloned causing transactions to fail" error. Then, if you try refreshing the screen, it redirects to the "Connect to Penumbra" page – see video example in penumbra-zone/web#1496.

@VanishMax VanishMax self-assigned this Oct 15, 2024
VanishMax added a commit that referenced this issue Oct 17, 2024
VanishMax added a commit that referenced this issue Oct 22, 2024
VanishMax added a commit that referenced this issue Oct 22, 2024
…al storage after cache clearing"

This reverts commit d085ff3.
VanishMax added a commit that referenced this issue Oct 22, 2024
VanishMax added a commit that referenced this issue Oct 22, 2024
…ge after cache clearing (#217)

* fix(extension): #207: fix resetting the fullSyncHeight in local storage after cache clearing

* fix(extension): #207: change zeros to undefined

* Revert "fix(extension): #207: change zeros to undefined"

This reverts commit 29ff515.

* Revert "fix(extension): #207: fix resetting the fullSyncHeight in local storage after cache clearing"

This reverts commit d085ff3.

* fix(extension): #207: use `allSettled` to remove the fullSyncHeight from the storage
@github-project-automation github-project-automation bot moved this from 🔎 In review to ✅ Done in Labs web Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
3 participants