Fixed SharedStorage deprecation warning caused by sodo-search#26416
Fixed SharedStorage deprecation warning caused by sodo-search#26416
Conversation
|
Cursor Agent can help with this pull request. Just |
WalkthroughThe 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
c9f8a7c to
cfa5f1a
Compare
… warning fixes #26318 The @tryghost/errors package brings in @stdlib/utils-copy which includes @stdlib/utils-keys. This package has bug detection code that iterates over all window properties, triggering a deprecation warning when it accesses window.sharedStorage in Chromium browsers. Removed the @tryghost/errors import which was only used for control flow (throwing an error to trigger a catch block). Replaced with a simple flag to indicate when fallback is needed. This also reduces the sodo-search bundle size from ~509KB to ~290KB.
cfa5f1a to
64fcc9e
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ghost/i18n/lib/i18n.js (1)
90-93:⚠️ Potential issue | 🟡 MinorDebug message may be misleading when
en.jsonexists but fails to load.When
locale === 'en'and the file exists but fails to load (e.g., invalid JSON), line 68 logs"Error loading theme locale file: en"and then line 91 logs"Theme en.json file not found", which is incorrect—the file was found but couldn't be parsed.Suggested fix
} else { - debug(`Theme en.json file not found`); + debug(`Theme en.json file not found or failed to load`); res = {}; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/i18n/lib/i18n.js` around lines 90 - 93, The debug message "Theme en.json file not found" is misleading when the file exists but fails to parse; update the logic around loading theme locale files in i18n.js so that you distinguish a missing file from a load/parse error: introduce or use the existing file-exists check (reference locale and the debug call) to only log "Theme {locale}.json file not found" when the file truly doesn't exist, and otherwise log a parse/load failure with the actual error (include the error in the debug/error message) and set res = {} as before; ensure the messages reference locale and reuse the same variables (locale, res, debug) so callers can see the correct cause.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@ghost/i18n/lib/i18n.js`:
- Around line 90-93: The debug message "Theme en.json file not found" is
misleading when the file exists but fails to parse; update the logic around
loading theme locale files in i18n.js so that you distinguish a missing file
from a load/parse error: introduce or use the existing file-exists check
(reference locale and the debug call) to only log "Theme {locale}.json file not
found" when the file truly doesn't exist, and otherwise log a parse/load failure
with the actual error (include the error in the debug/error message) and set res
= {} as before; ensure the messages reference locale and reuse the same
variables (locale, res, debug) so callers can see the correct cause.
ref #26416 Fixed `SharedStorage` deprecation warning
ref #26416 Fixed `SharedStorage` deprecation warning
ref https://linear.app/ghost/issue/ONC-1462
fixes #26527
fixes #26318
@tryghost/errorspulls in@stdlib/utils-keyswhich iterates allwindowproperties on load, triggering a Chromium SharedStorage deprecation warning.The import was only used in
ghost/i18nto throw an error for control flow ingenerateThemeResources. Sinceghost/i18nis bundled into sodo-search (and other browser apps), the entire@stdlibchain was included in the client bundle unnecessarily.Removed the
@tryghost/errorsimport and replaced the throw-to-catch pattern with a flag to indicate when English fallback is needed.