Skip to content

Commit dea0e98

Browse files
JOHNJOHN
authored andcommitted
Fix content script: remove storage utility import
- Content scripts should use chrome.storage.local directly - Don't import utils/storage which pulls in dependencies that cause issues - This prevents 'window is not defined' and other errors - Content script bundle size reduced from 83.75kB to 73.72kB
1 parent 10a4ed6 commit dea0e98

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/AnnotationManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ export class AnnotationManager {
6565
this.injectStyles();
6666

6767
// Load annotation enabled setting (default: true)
68+
// Use chrome.storage.local directly - don't import utils/storage which has dependencies
6869
try {
69-
const { storage } = await import('../utils/storage');
70-
const enabled = await storage.getSetting<boolean>('annotationsEnabled', true);
71-
this.annotationsEnabled = enabled ?? true;
70+
const result = await chrome.storage.local.get('annotationsEnabled');
71+
this.annotationsEnabled = result.annotationsEnabled ?? true;
7272
logger.info('ContentScript', 'Annotation enabled setting loaded', { enabled: this.annotationsEnabled });
7373
} catch (error) {
7474
logger.warn('ContentScript', 'Failed to load annotation setting, defaulting to enabled', error as Error);
@@ -459,8 +459,8 @@ export class AnnotationManager {
459459
this.annotationsEnabled = newValue;
460460

461461
try {
462-
const { storage } = await import('../utils/storage');
463-
await storage.saveSetting('annotationsEnabled', newValue);
462+
// Save setting directly using chrome.storage.local
463+
await chrome.storage.local.set({ annotationsEnabled: newValue });
464464
logger.info('ContentScript', 'Annotations toggled via keyboard', { enabled: newValue });
465465

466466
// Show visual feedback

0 commit comments

Comments
 (0)