Skip to content

Commit

Permalink
Remove "directLink" prop (#488)
Browse files Browse the repository at this point in the history
Is not required anymore since "Link" of react-router-dom is a "<a>" element now anyway.
It also caused the following warning

"react-dom.development.js:86  Warning: React does not recognize the `directLink` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `directlink` instead. If you accidentally passed it from a parent component, remove it from the DOM element"
  • Loading branch information
schroda authored Dec 9, 2023
1 parent ad0f072 commit db5d3ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
11 changes: 1 addition & 10 deletions src/components/util/ListItemLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
import { Link } from 'react-router-dom';
import { ListItemButton, ListItemButtonProps } from '@mui/material';

export function ListItemLink(props: ListItemButtonProps<typeof Link, { directLink?: boolean }>) {
const { directLink, to } = props;
if (directLink) {
if (typeof to !== 'string') {
throw new Error('ListItemLink: "to" has to be a string in case it is a directLink');
}

return <ListItemButton component="a" href={to} {...props} />;
}

export function ListItemLink(props: ListItemButtonProps<typeof Link>) {
return <ListItemButton component={Link} {...props} />;
}
6 changes: 3 additions & 3 deletions src/screens/settings/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ export function About() {
</ListSubheader>
}
>
<ListItemLink directLink to={aboutServer.github}>
<ListItemLink to={aboutServer.github}>
<ListItemText primary={t('settings.about.server.label.github')} secondary={aboutServer.github} />
</ListItemLink>
<ListItemLink directLink to="https://github.com/Suwayomi/Tachidesk-WebUI">
<ListItemLink to="https://github.com/Suwayomi/Tachidesk-WebUI">
<ListItemText
primary={t('settings.about.webui.label.github')}
secondary="https://github.com/Suwayomi/Tachidesk-WebUI"
/>
</ListItemLink>
<ListItemLink directLink to={aboutServer.discord}>
<ListItemLink to={aboutServer.discord}>
<ListItemText primary={t('global.label.discord')} secondary={aboutServer.discord} />
</ListItemLink>
</List>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/settings/Backup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function Backup() {
return (
<>
<List sx={{ padding: 0 }}>
<ListItemLink to={requestManager.getExportBackupUrl()} directLink>
<ListItemLink to={requestManager.getExportBackupUrl()}>
<ListItemText
primary={t('settings.backup.label.create_backup')}
secondary={t('settings.backup.label.create_backup_info')}
Expand Down

0 comments on commit db5d3ff

Please sign in to comment.