Skip to content

Commit 90acb53

Browse files
committed
fix(web): Do not use immediately-invoked function expressions
Do not use immediately-invoked function expressions in JSX. IIFEs will not be optimized by React Compiler @eslint-react/unsupported-syntax
1 parent 8ed3aac commit 90acb53

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

web/src/components/DocumentControlButtons.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ export default function DocumentControlButtons(props: Props): React.JSX.Element
9898
<div className={styles['share-modal-copy-container']}>
9999
<button
100100
className={styles['share-modal-copy']}
101-
onClick={() => {
102-
void (async () => {
103-
await navigator.clipboard.writeText(props.getShareUrl({ useLatest: shareModalUseLatest, hideUi: shareModalHideUi }))
104-
})()
101+
onClick={async () => {
102+
const url = props.getShareUrl({
103+
useLatest: shareModalUseLatest,
104+
hideUi: shareModalHideUi
105+
});
106+
await navigator.clipboard.writeText(url);
105107
}}
106108
>
107109
Copy

web/src/pages/Claim.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ export default function Claim(): JSX.Element {
9797
<button
9898
type="submit"
9999
disabled={token !== ''}
100-
onClick={() => {
101-
;(async () => {
102-
await claim()
103-
})().catch((e) => {
104-
console.error(e)
105-
})
100+
onClick={async () => {
101+
try {
102+
await claim();
103+
} catch (e) {
104+
console.error(e);
105+
}
106106
}}
107107
>
108108
Claim

0 commit comments

Comments
 (0)