Skip to content

Commit b85449b

Browse files
committed
remove() doesnt throw
1 parent 1d90372 commit b85449b

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

Diff for: packages/feedback/src/core/components/Actor.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { DEBUG_BUILD } from '../../util/debug-build';
21
import { DOCUMENT, TRIGGER_LABEL } from '../../constants';
32
import { createActorStyles } from './Actor.css';
43
import { FeedbackIcon } from './FeedbackIcon';
5-
import { logger } from '@sentry/core';
64

75
export interface ActorProps {
86
triggerLabel: string;
@@ -48,15 +46,8 @@ export function Actor({ triggerLabel, triggerAriaLabel, shadow, styleNonce }: Ac
4846
shadow.appendChild(el);
4947
},
5048
removeFromDom(): void {
51-
try {
52-
el.remove();
53-
style.remove();
54-
} catch {
55-
DEBUG_BUILD &&
56-
logger.error(
57-
'[Feedback] Error when trying to remove Actor from the DOM. It is not appended to the DOM yet!',
58-
);
59-
}
49+
el.remove();
50+
style.remove();
6051
},
6152
show(): void {
6253
el.ariaHidden = 'false';

Diff for: packages/feedback/src/modal/integration.tsx

+2-10
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import * as hooks from 'preact/hooks';
55
import { DOCUMENT } from '../constants';
66
import { Dialog } from './components/Dialog';
77
import { createDialogStyles } from './components/Dialog.css';
8-
import { DEBUG_BUILD } from 'src/util/debug-build';
9-
import { logger } from '@sentry/core';
108

119
function getUser(): User | undefined {
1210
const currentUser = getCurrentScope().getUser();
@@ -46,14 +44,8 @@ export const feedbackModalIntegration = ((): FeedbackModalIntegration => {
4644
}
4745
},
4846
removeFromDom(): void {
49-
try {
50-
el.remove();
51-
style.remove();
52-
} catch {
53-
DEBUG_BUILD &&
54-
logger.error('[Feedback] Error when trying to remove Modal from the DOM. It is not appended to the DOM yet!');
55-
throw new Error('[Feedback] Modal is not appended to DOM, nothing to remove.');
56-
}
47+
el.remove();
48+
style.remove();
5749
DOCUMENT.body.style.overflow = originalOverflow;
5850
},
5951
open() {

0 commit comments

Comments
 (0)