Skip to content

Commit fde5a04

Browse files
authored
fix: add fallback value for JSX elements (qiuwenbaike#1704)
* fix: add fallback value for JSX elements
1 parent 92a772f commit fde5a04

File tree

11 files changed

+91
-97
lines changed

11 files changed

+91
-97
lines changed

dist/EasyArchive/EasyArchive.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/GeoLocationReader/GeoLocationReader.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/MarkRights-Userpage/MarkRights-Userpage.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/PagePatroller/PagePatroller.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/QueryContributors/QueryContributors.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/EasyArchive/modules/components/react.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ import {sanitize} from '../util/sanitize';
66

77
interface FooterNoticeProps {
88
id?: string;
9-
children?: ReactElement | ReactElement[];
9+
children?: ReactElement;
1010
}
1111

12-
const FooterNotice = ({id, children = <></>}: FooterNoticeProps) => {
12+
const FooterNotice = ({id = OPTIONS.elementId, children = <></>}: FooterNoticeProps) => {
1313
const {skin} = mw.config.get();
1414

1515
return (
1616
<>
1717
{skin === 'citizen' ? (
1818
<section
19-
id={id ?? OPTIONS.elementId}
19+
id={id}
2020
className={[footerNotice, 'page-info__item', 'citizen-footer__pageinfo-item', 'noprint']}
2121
>
2222
{children}
2323
</section>
2424
) : ['vector', 'vector-2022', 'gongbi'].includes(skin) || document.querySelector('ul#footer-info') ? (
25-
<li id={id ?? OPTIONS.elementId} className={[footerNotice, 'noprint']}>
25+
<li id={id} className={[footerNotice, 'noprint']}>
2626
{children}
2727
</li>
2828
) : (
29-
<div id={id ?? OPTIONS.elementId} className={[footerNotice, 'noprint']}>
29+
<div id={id} className={[footerNotice, 'noprint']}>
3030
{children}
3131
</div>
3232
)}
@@ -104,10 +104,10 @@ const OnClick = ({textContent, className, onClick}: OnClickProps) => (
104104
);
105105

106106
interface SectionIDProps {
107-
children?: ReactElement | ReactElement[];
107+
children?: ReactElement;
108108
}
109109

110-
const SectionID = ({children}: SectionIDProps) => <span className={sectionIdSpan}>{children}</span>;
110+
const SectionID = ({children = <></>}: SectionIDProps) => <span className={sectionIdSpan}>{children}</span>;
111111

112112
const Pipe = () => <span className="mw-editsection-divider" textContent={'|'} />;
113113

src/EasyArchive/modules/components/sectionLink.tsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,32 +96,34 @@ const ArchiveAndDeleteSectionLink = ({
9696
arcLoc,
9797
}: ArchiveAndDeleteSectionLinkProps) => (
9898
<SectionID>
99-
{secArc === '1' ? (
100-
<ArchiveSectionLink
101-
sectionIdSpans={sectionIdSpans}
102-
messageChannel={messageChannel}
103-
refreshChannel={refreshChannel}
104-
indexNo={indexNo}
105-
anchor={anchor}
106-
toastifyInstance={toastifyInstance}
107-
archiveTo={arcLoc}
108-
/>
109-
) : (
110-
<></>
111-
)}
112-
{secArc === '1' && secDel === '1' ? <Pipe /> : <></>}
113-
{secDel === '1' ? (
114-
<RemoveSectionLink
115-
sectionIdSpans={sectionIdSpans}
116-
messageChannel={messageChannel}
117-
refreshChannel={refreshChannel}
118-
indexNo={indexNo}
119-
anchor={anchor}
120-
toastifyInstance={toastifyInstance}
121-
/>
122-
) : (
123-
<></>
124-
)}
99+
<>
100+
{secArc === '1' ? (
101+
<ArchiveSectionLink
102+
sectionIdSpans={sectionIdSpans}
103+
messageChannel={messageChannel}
104+
refreshChannel={refreshChannel}
105+
indexNo={indexNo}
106+
anchor={anchor}
107+
toastifyInstance={toastifyInstance}
108+
archiveTo={arcLoc}
109+
/>
110+
) : (
111+
<></>
112+
)}
113+
{secArc === '1' && secDel === '1' ? <Pipe /> : <></>}
114+
{secDel === '1' ? (
115+
<RemoveSectionLink
116+
sectionIdSpans={sectionIdSpans}
117+
messageChannel={messageChannel}
118+
refreshChannel={refreshChannel}
119+
indexNo={indexNo}
120+
anchor={anchor}
121+
toastifyInstance={toastifyInstance}
122+
/>
123+
) : (
124+
<></>
125+
)}
126+
</>
125127
</SectionID>
126128
);
127129

src/GeoLocationReader/modules/components/react.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import {getMessage} from '../i18n';
44

55
interface FooterNoticeProps {
66
spanClass: string;
7-
children?: ReactElement | ReactElement[];
7+
children?: ReactElement;
88
}
99

1010
const FooterNotice = ({spanClass, children = <></>}: FooterNoticeProps) => {
1111
const {skin} = mw.config.get();
12-
children ??= <></>;
1312

1413
return (
1514
<>

src/MarkRights-Userpage/components/react.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {UserRights} from '~/MarkRights/modules/types';
33

44
interface FooterNoticeProps {
55
spanClass: string;
6-
children?: ReactElement | ReactElement[];
6+
children?: ReactElement;
77
}
88

99
const FooterNotice = ({spanClass, children = <></>}: FooterNoticeProps) => {
@@ -14,12 +14,12 @@ const FooterNotice = ({spanClass, children = <></>}: FooterNoticeProps) => {
1414
<>
1515
{skin === 'citizen' ? (
1616
<section className={[...classNames, 'page-info__item', 'citizen-footer__pageinfo-item', 'noprint']}>
17-
{children ?? <></>}
17+
{children}
1818
</section>
1919
) : ['vector', 'vector-2022', 'gongbi'].includes(skin) || document.querySelector('ul#footer-info') ? (
20-
<li className={[classNames, 'noprint']}>{children ?? <></>}</li>
20+
<li className={[classNames, 'noprint']}>{children}</li>
2121
) : (
22-
<div className={[classNames, 'noprint']}>{children ?? <></>}</div>
22+
<div className={[classNames, 'noprint']}>{children}</div>
2323
)}
2424
</>
2525
);

src/PagePatroller/modules/components/react.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,25 @@ import {getMessage} from '../i18n';
44

55
interface FooterNoticeProps {
66
id?: string;
7-
children?: ReactElement | ReactElement[];
7+
children?: ReactElement;
88
}
99

10-
const FooterNotice = ({id, children = <></>}: FooterNoticeProps) => {
10+
const FooterNotice = ({id = OPTIONS.elementId, children = <></>}: FooterNoticeProps) => {
1111
const {skin} = mw.config.get();
1212

1313
return (
1414
<>
1515
{skin === 'citizen' ? (
16-
<section
17-
id={id ?? OPTIONS.elementId}
18-
className={[OPTIONS.elementId, 'page-info__item', 'citizen-footer__pageinfo-item', 'noprint']}
19-
>
20-
{children ?? <></>}
16+
<section id={id} className={[id, 'page-info__item', 'citizen-footer__pageinfo-item', 'noprint']}>
17+
{children}
2118
</section>
2219
) : ['vector', 'vector-2022', 'gongbi'].includes(skin) || document.querySelector('ul#footer-info') ? (
23-
<li id={id ?? OPTIONS.elementId} className={[OPTIONS.elementId, 'noprint']}>
24-
{children ?? <></>}
20+
<li id={id} className={[id, 'noprint']}>
21+
{children}
2522
</li>
2623
) : (
27-
<div id={id ?? OPTIONS.elementId} className={[OPTIONS.elementId, 'noprint']}>
28-
{children ?? <></>}
24+
<div id={id} className={[id, 'noprint']}>
25+
{children}
2926
</div>
3027
)}
3128
</>

0 commit comments

Comments
 (0)