Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2ee98e

Browse files
committed
fix company tags getting added multiple times
1 parent 827ddef commit a2ee98e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

‎src/content-script/update-description-tab.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,25 @@ function showCompanyTags(problemTitle: string) {
147147
const showCompanyTags = result.showCompanyTags;
148148
let companyTagContainer = document.getElementById('companyTagContainer');
149149

150+
// First handle visibility
150151
if (!showCompanyTags) {
151152
if (companyTagContainer) {
152153
companyTagContainer.style.display = 'none';
153154
}
154155
return;
156+
} else if (companyTagContainer && companyTagContainer instanceof HTMLElement) {
157+
companyTagContainer.style.display = 'flex';
158+
// If container exists and is visible, just update styles
159+
chrome.storage.local.get(['isDarkTheme'], (result) => {
160+
const isDark = result.isDarkTheme;
161+
const tags = companyTagContainer.querySelectorAll('.company-tag');
162+
tags.forEach(tag => {
163+
if (tag instanceof HTMLElement) {
164+
updateCompanyTagStyle(tag, isDark);
165+
}
166+
});
167+
});
168+
return;
155169
}
156170

157171
// Try to find the description element with retries

‎src/popup/settings.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ document.addEventListener('DOMContentLoaded', () => {
3737
// Apply the selected theme
3838
setTheme(selectedValue);
3939

40-
// Update LeetCode problem if active
40+
// Update LeetCode problem if active - only update solutions tab
4141
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
4242
if (tabs[0] && tabs[0].id) {
43-
chrome.tabs.sendMessage(tabs[0].id, { action: 'updateDescription', title: tabs[0].title || 'title' });
4443
chrome.tabs.sendMessage(tabs[0].id, { action: 'updateSolutions', title: tabs[0].title || 'title' });
4544
}
4645
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /