Skip to content

Commit e73fbe3

Browse files
committed
Try fixes
1 parent 5e032f1 commit e73fbe3

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

src/components/MediaSource.tsx

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ipcRenderer } from 'electron';
2-
import { type MouseEventHandler, useEffect, useState } from 'react';
2+
import { type MouseEventHandler, useState } from 'react';
33
import {
44
type WrappedComponentProps,
55
defineMessages,
@@ -54,12 +54,6 @@ function MediaSource(props: IProps) {
5454
const [trackerId, setTrackerId] = useState<string | null>(null);
5555
const [loadingSources, setLoadingSources] = useState<boolean>(false);
5656

57-
ipcRenderer.on(`select-capture-device:${service.id}`, (_event, data) => {
58-
if (loadingSources) return;
59-
setShow(true);
60-
setTrackerId(data.trackerId);
61-
});
62-
6357
const handleOnClick = (e: any) => {
6458
const { id } = e.currentTarget.dataset;
6559
window['ferdium'].actions.service.sendIPCMessage({
@@ -75,35 +69,35 @@ function MediaSource(props: IProps) {
7569
setTrackerId(null);
7670
};
7771

78-
// biome-ignore lint/correctness/useExhaustiveDependencies: This effect should only run when `show` changes
79-
useEffect(() => {
80-
if (show) {
81-
setLoadingSources(true);
82-
ipcRenderer
83-
.invoke('get-desktop-capturer-sources')
84-
.then(sources => {
85-
if (isWayland) {
86-
// On Linux, we do not need to prompt the user again for the source
87-
handleOnClick({
88-
currentTarget: { dataset: { id: sources[0].id } },
89-
});
90-
return;
91-
}
72+
const showCaptureSources = () => {
73+
setLoadingSources(true);
74+
ipcRenderer
75+
.invoke('get-desktop-capturer-sources')
76+
.then(sources => {
77+
if (isWayland) {
78+
// On Linux, we do not need to prompt the user again for the source
79+
handleOnClick({
80+
currentTarget: { dataset: { id: sources[0].id } },
81+
});
82+
return;
83+
}
9284

93-
setSources(sources);
94-
setLoadingSources(false);
95-
})
96-
// silence the error
97-
.catch(() => {
98-
setShow(false);
99-
setSources([]);
100-
setLoadingSources(false);
101-
});
102-
} else {
103-
setSources([]);
104-
setLoadingSources(false);
105-
}
106-
}, [show]);
85+
setSources(sources);
86+
setLoadingSources(false);
87+
})
88+
// silence the error
89+
.catch(() => {
90+
setShow(false);
91+
setSources([]);
92+
setLoadingSources(false);
93+
});
94+
};
95+
96+
ipcRenderer.on(`select-capture-device:${service.id}`, (_event, data) => {
97+
if (loadingSources) return;
98+
showCaptureSources();
99+
setTrackerId(data.trackerId);
100+
});
107101

108102
if (!show) {
109103
return null;

src/components/ui/FAB.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class Button extends Component<IProps> {
3636
};
3737

3838
return (
39-
// eslint-disable-next-line @eslint-react/dom/no-missing-button-type
4039
<button {...buttonProps} type="button">
4140
{children}
4241
</button>

src/components/ui/SearchInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class SearchInput extends Component<IProps, IState> {
8282

8383
return (
8484
<div className={classnames([className, 'search-input'])}>
85-
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
8685
<label htmlFor={name}>
8786
<Icon icon={mdiMagnify} />
8887
<input

src/components/ui/button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class ButtonComponent extends Component<IProps, IState> {
223223
) : (
224224
<button
225225
id={id}
226-
// eslint-disable-next-line react/button-has-type, @eslint-react/dom/no-missing-button-type
226+
// eslint-disable-next-line react/button-has-type
227227
type={type}
228228
onClick={onClick}
229229
className={classnames({

0 commit comments

Comments
 (0)