Skip to content

Commit

Permalink
fix(lint): Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
David Code Howard committed Oct 30, 2023
1 parent 94ccb96 commit 38e0a65
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions dev-client/src/screens/SiteTransferProjectScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ import {FormTooltip} from 'terraso-mobile-client/components/common/Form';

type Props = {projectId: string};

const UNAFFILIATED = {
projectId: Symbol('unaffiliated'),
projectName: '',
};

export const SiteTransferProjectScreen = ({projectId}: Props) => {
const {t} = useTranslation();
const dispatch = useDispatch();
const navigation = useNavigation();

// Don't want this re-rendering
// Otherwise it declares multiple symbols that are *not* equal
const UNAFFILIATED = useMemo(
() => ({
projectId: Symbol('unaffiliated'),
projectName: t('projects.transfer_sites.unaffiliated'),
}),
[],
);
UNAFFILIATED.projectName = t('projects.transfer_sites.unaffiliated');

const hasUnaffiliatedProject = (o: object) =>
Object.getOwnPropertySymbols(o).find(
Expand All @@ -50,7 +47,7 @@ export const SiteTransferProjectScreen = ({projectId}: Props) => {
projectName: UNAFFILIATED.projectName,
}));
return [...prospectiveSites, ...unaffiliated];
}, [sites, projectId]);
}, [sites, projectId, unaffiliatedSites]);

const projectsExcludingCurrent: Record<
string | symbol,
Expand Down Expand Up @@ -108,13 +105,13 @@ export const SiteTransferProjectScreen = ({projectId}: Props) => {
displayedProjects[UNAFFILIATED.projectId],
]);
}
const projects = pool.sort((a, b) => {
const sortedProjects = pool.sort((a, b) => {
if (a[1].projId === UNAFFILIATED.projectId) {
return -1;
}
return a[1].projectName.localeCompare(b[1].projectName);
});
return projects;
return sortedProjects;
}, [displayedProjects]);

const projectRecord = useMemo(() => {
Expand Down Expand Up @@ -166,7 +163,7 @@ export const SiteTransferProjectScreen = ({projectId}: Props) => {
const payload = {projectId, siteIds};
await dispatch(transferSites(payload));
return navigation.pop();
}, [projState]);
}, [projState, dispatch, navigation, projectId]);

const ListHeader = (
<VStack space="10px" px="12px" pt="5%">
Expand Down

0 comments on commit 38e0a65

Please sign in to comment.