Skip to content

Commit a4b2a41

Browse files
committed
Enhance profile switching functionality: pass origin parameter to limit refresh scope to the floating panel
1 parent 6e35ada commit a4b2a41

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

floating-panel-settings.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ window.MaxExtensionFloatingPanel.switchToProfile = function (profileName) {
227227
// Prevent switching to the same profile.
228228
if (profileName === this.currentProfileName) return;
229229
chrome.runtime.sendMessage(
230-
{ type: 'switchProfile', profileName: profileName },
230+
// Pass origin so receivers (including our own content script)
231+
// can limit refresh scope to the floating panel only.
232+
{ type: 'switchProfile', profileName: profileName, origin: 'panel' },
231233
(response) => {
232234
if (response.error) {
233235
logConCgp(`[floating-panel] Error switching to profile ${profileName}: ${response.error}`);
@@ -244,7 +246,8 @@ window.MaxExtensionFloatingPanel.switchToProfile = function (profileName) {
244246
} else if (typeof window.__OCP_nukeAndRefresh === 'function') {
245247
window.__OCP_nukeAndRefresh(response.config);
246248
} else {
247-
window.MaxExtensionButtonsInit.updateButtonsForProfileChange();
249+
// Fallback: update only the floating panel, never inline buttons
250+
window.MaxExtensionButtonsInit.updateButtonsForProfileChange('panel');
248251
}
249252
logConCgp(`[floating-panel] Successfully switched to profile: ${profileName}`);
250253
}

0 commit comments

Comments
 (0)