Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
set on main style
  • Loading branch information
chargome committed Feb 20, 2026
commit 489785db3e16383fbcc14fe5594f969142997ee1
11 changes: 7 additions & 4 deletions packages/feedback/src/core/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export const buildFeedbackIntegration = ({
};

let _shadow: ShadowRoot | null = null;
let _mainStyle: HTMLStyleElement | null = null;
let _subscriptions: Unsubscribe[] = [];

/**
Expand All @@ -185,7 +186,8 @@ export const buildFeedbackIntegration = ({
DOCUMENT.body.appendChild(host);

_shadow = host.attachShadow({ mode: 'open' });
_shadow.appendChild(createMainStyles(options));
_mainStyle = createMainStyles(options);
_shadow.appendChild(_mainStyle);
}
return _shadow;
};
Expand Down Expand Up @@ -355,13 +357,13 @@ export const buildFeedbackIntegration = ({
setTheme(colorScheme: 'light' | 'dark' | 'system'): void {
_options.colorScheme = colorScheme;
if (_shadow) {
const existingStyle = _shadow.querySelector('style');
const newStyle = createMainStyles(_options);
if (existingStyle) {
_shadow.replaceChild(newStyle, existingStyle);
if (_mainStyle) {
_shadow.replaceChild(newStyle, _mainStyle);
} else {
_shadow.prepend(newStyle);
}
_mainStyle = newStyle;
}
},

Expand All @@ -372,6 +374,7 @@ export const buildFeedbackIntegration = ({
if (_shadow) {
_shadow.parentElement?.remove();
_shadow = null;
_mainStyle = null;
}
// Remove any lingering subscriptions
_subscriptions.forEach(sub => sub());
Expand Down
Loading