Fix options page crash: reference chrome.storage[area] reactively and await storage.get() in storage-usage.svelte#8999
Draft
Fix options page crash: reference chrome.storage[area] reactively and await storage.get() in storage-usage.svelte#8999
Conversation
…pture on Firefox Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix options failing to load due to JavaScript error
Fix options page crash: reference chrome.storage[area] reactively in storage-usage.svelte
Feb 21, 2026
fregante
reviewed
Feb 21, 2026
source/options/storage-usage.svelte
Outdated
| if (item) { | ||
| used = getTrueSizeOfObject(storage.get(item)); | ||
| used = getTrueSizeOfObject(chrome.storage[area].get(item)); | ||
| } |
Member
There was a problem hiding this comment.
@copilot I think this was a bug too: get() returns a promise that needs to be awaited
Contributor
Author
There was a problem hiding this comment.
Fixed in f9a3e1b. chrome.storage[area].get(item) returns a Promise, so passing it to getTrueSizeOfObject was a bug. Replaced the $effect body with void getStorageUsage(), which already properly awaits storage.get(item) via getStoredItemSize.
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Copilot
AI
changed the title
Fix options page crash: reference chrome.storage[area] reactively in storage-usage.svelte
Fix options page crash: reference chrome.storage[area] reactively and await storage.get() in storage-usage.svelte
Feb 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Firefox, the options page crashes with
Error: An unexpected error occurred undefineddue to two bugs instorage-usage.svelte:Stale prop capture:
chrome.storage[area]was evaluated once at module scope — before the custom element'sareaattribute is applied — leavingstorageasundefined. Svelte 5 warns about this exact pattern (state_referenced_locally).Unawaited Promise:
chrome.storage[area].get(item)returns aPromise, which was being passed synchronously togetTrueSizeOfObjectinstead of being awaited.Changes:
const storage = chrome.storage[area]assignment$derived.by()now readschrome.storage[area]inside the callback with a localstoragevariable, respecting Svelte 5's reactive prop lifecycle$effectbody (which passed an unawaited Promise togetTrueSizeOfObject) withvoid getStorageUsage(), which correctly awaits the storage read viagetStoredItemSizeTest URLs
https://github.com/settings/profile (options page —
chrome-extension://.../options.html)Screenshot
Original prompt
This section details on the original issue you should resolve
<issue_title>Options fail to load</issue_title>
<issue_description>### Description
When trying to open the refine github options Im running into a Javascript error:
These are the errors in the console:
How to replicate the issue + URL
It happens in the refined-github options page.
Extension version
26.2.2
Browser(s) used
firefox 147.0.3
Token⚠️
<agent_instructions>Fix svelte issue</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@fregante Are you using Firefox normally? Is it the developer version? Are you loading it in a special way? Are you logged into Firefox Accounts?The file appears to be Firefox' own JS code; "area" is
sync, which Firefox has historically being annoying with. I'm not sure why it's suddenly breaking for you since as far as I know we didn't make any changes in that area recently.Are you a new Refined GitHub user or did it stop working in the latest version?</comment_new>
<comment_new>@fregante
Partially never mind: the error appears to be in Svelte's code, producing
undefinedwhere it shouldn't be. It's generated code so I thought it was Firefox' and not ours 😅 </comment_new><comment_new>@SunsetTechuila