diff --git a/src/components/App/SignalRHub.tsx b/src/components/App/SignalRHub.tsx index 0606481cda..38e7d70c68 100644 --- a/src/components/App/SignalRHub.tsx +++ b/src/components/App/SignalRHub.tsx @@ -34,7 +34,7 @@ export default function SignalRHub(): ReactElement { const finishDisconnect = useCallback((): void => { setConnection(undefined); setDisconnect(false); - }, [setConnection, setDisconnect]); + }, []); /** Act on the disconnect state to stop and delete the connection. */ useEffect(() => { @@ -57,7 +57,7 @@ export default function SignalRHub(): ReactElement { setReconnect(false); setConnection(newConnection); } - }, [disconnect, reconnect, setConnection, setReconnect]); + }, [disconnect, reconnect]); /** Any change in exportState should cause a disconnect. * Only ExportStatus.Exporting should open a new connection. @@ -67,7 +67,7 @@ export default function SignalRHub(): ReactElement { if (exportState.status === ExportStatus.Exporting) { setReconnect(true); } - }, [exportState, setDisconnect, setReconnect]); + }, [exportState]); /** Once a connection is opened, start the relevant methods. */ useEffect(() => { diff --git a/src/components/AppBar/UserMenu.tsx b/src/components/AppBar/UserMenu.tsx index 1eea6f9426..371dcaad8a 100644 --- a/src/components/AppBar/UserMenu.tsx +++ b/src/components/AppBar/UserMenu.tsx @@ -12,7 +12,7 @@ import { MenuItem, Typography, } from "@mui/material"; -import React, { ReactElement, useState } from "react"; +import React, { Fragment, ReactElement, useState } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; @@ -89,7 +89,7 @@ export default function UserMenu(props: TabProps): ReactElement { ) : ( - + )} {avatar ? ( diff --git a/src/components/Buttons/FlagButton.tsx b/src/components/Buttons/FlagButton.tsx index b9cdc8d4e2..5dd801c6d1 100644 --- a/src/components/Buttons/FlagButton.tsx +++ b/src/components/Buttons/FlagButton.tsx @@ -20,7 +20,7 @@ export default function FlagButton(props: FlagButtonProps): ReactElement { useEffect(() => { setActive(props.flag.active); setText(props.flag.active ? props.flag.text : undefined); - }, [props.flag, setActive, setText]); + }, [props.flag]); function updateFlag(text: string): void { setActive(true); diff --git a/src/components/Buttons/LoadingDoneButton.tsx b/src/components/Buttons/LoadingDoneButton.tsx index 7c83f6460c..2055123076 100644 --- a/src/components/Buttons/LoadingDoneButton.tsx +++ b/src/components/Buttons/LoadingDoneButton.tsx @@ -1,17 +1,17 @@ import { Check } from "@mui/icons-material"; import { Button, CircularProgress } from "@mui/material"; import { ButtonProps } from "@mui/material/Button"; -import React, { ReactElement } from "react"; +import { ReactElement, ReactNode } from "react"; import { useTranslation } from "react-i18next"; import { themeColors } from "types/theme"; interface LoadingDoneProps { buttonProps?: ButtonProps; - children?: React.ReactNode; + children?: ReactNode; disabled?: boolean; done?: boolean; - doneText?: React.ReactNode | string; + doneText?: ReactNode | string; loading?: boolean; } @@ -36,10 +36,10 @@ export default function LoadingDoneButton( }} > {props.done ? ( - + <> {props.doneText ?? t("buttons.done")} - + ) : ( props.children )} diff --git a/src/components/DataEntry/DataEntryHeader.tsx b/src/components/DataEntry/DataEntryHeader.tsx index 037d9868bc..4d0333f046 100644 --- a/src/components/DataEntry/DataEntryHeader.tsx +++ b/src/components/DataEntry/DataEntryHeader.tsx @@ -1,6 +1,6 @@ import { Help } from "@mui/icons-material"; import { Switch, Typography } from "@mui/material"; -import React, { ReactElement } from "react"; +import { ReactElement } from "react"; import { useTranslation } from "react-i18next"; import { Key } from "ts-key-enum"; @@ -52,12 +52,12 @@ export default function DataEntryHeader( function Questions(props: { questions: string[] }): ReactElement { return ( - + <> {props.questions.map((question, index) => ( {question} ))} - + ); } diff --git a/src/components/DataEntry/DataEntryTable/NewEntry/index.tsx b/src/components/DataEntry/DataEntryTable/NewEntry/index.tsx index d1d6dde042..0e657ea901 100644 --- a/src/components/DataEntry/DataEntryTable/NewEntry/index.tsx +++ b/src/components/DataEntry/DataEntryTable/NewEntry/index.tsx @@ -119,7 +119,7 @@ export default function NewEntry(props: NewEntryProps): ReactElement { resetNewEntry(); setVernOpen(false); focus(FocusTarget.Vernacular); - }, [focus, resetNewEntry, setVernOpen]); + }, [focus, resetNewEntry]); /** Reset when tree opens, except for the first time it is open. */ useEffect(() => { diff --git a/src/components/DataEntry/DataEntryTable/index.tsx b/src/components/DataEntry/DataEntryTable/index.tsx index 8c44cfac8a..6c510683a6 100644 --- a/src/components/DataEntry/DataEntryTable/index.tsx +++ b/src/components/DataEntry/DataEntryTable/index.tsx @@ -68,7 +68,7 @@ enum DefunctStatus { Retire = "RETIRE", } -/*** Add current semantic domain to specified sense within a word. */ +/** Add current semantic domain to specified sense within a word. */ export function addSemanticDomainToSense( semDom: SemanticDomain, word: Word, @@ -83,7 +83,7 @@ export function addSemanticDomainToSense( return { ...word, senses }; } -/*** Focus on a specified object. */ +/** Focus on a specified object. */ export function focusInput(ref: RefObject): void { if (ref.current) { ref.current.focus(); @@ -91,7 +91,7 @@ export function focusInput(ref: RefObject): void { } } -/*** Find suggestions for given text from a list of strings. */ +/** Find suggestions for given text from a list of strings. */ export function getSuggestions( text: string, all: string[], @@ -121,13 +121,13 @@ export function getSuggestions( return some; } -/*** Return a copy of the semantic domain with current UserId and timestamp. */ +/** Return a copy of the semantic domain with current UserId and timestamp. */ export function makeSemDomCurrent(semDom: SemanticDomain): SemanticDomain { const created = new Date().toISOString(); return { ...semDom, created, userId: getUserId() }; } -/*** Given a WordAccess and a new gloss, returns a copy of the word +/** Given a WordAccess and a new gloss, returns a copy of the word * with the gloss of the specified sense changed to the new gloss. * If that sense has multiple semantic domains, split into two senses: * one with the specified domain and the new gloss, @@ -172,17 +172,7 @@ export function updateEntryGloss( return { ...entry.word, senses }; } -interface DataEntryTableState { - // word data - allVerns: string[]; - allWords: Word[]; - recentWords: WordAccess[]; - // state management - defunctUpdates: Hash; - defunctWordIds: Hash; - isFetchingFrontier: boolean; - senseSwitches: SenseSwitch[]; - // new entry state +interface NewEntryState { newAudioUrls: string[]; newGloss: string; newNote: string; @@ -192,7 +182,38 @@ interface DataEntryTableState { suggestedDups: Word[]; } -/*** A data entry table containing recent word entries. */ +const defaultNewEntryState = (): NewEntryState => ({ + newAudioUrls: [], + newGloss: "", + newNote: "", + newVern: "", + selectedDup: undefined, + suggestedDups: [], + suggestedVerns: [], +}); + +interface EntryTableState extends NewEntryState { + defunctUpdates: Hash; + defunctWordIds: Hash; + recentWords: WordAccess[]; + senseSwitches: SenseSwitch[]; +} + +const defaultEntryTableState = (): EntryTableState => ({ + ...defaultNewEntryState(), + defunctUpdates: {}, + defunctWordIds: {}, + recentWords: [], + senseSwitches: [], +}); + +interface DataEntryTableState extends EntryTableState { + allVerns: string[]; + allWords: Word[]; + isFetchingFrontier: boolean; +} + +/** A data entry table containing recent word entries. */ export default function DataEntryTable( props: DataEntryTableProps ): ReactElement { @@ -214,22 +235,10 @@ export default function DataEntryTable( const updateHeight = props.updateHeight; const [state, setState] = useState({ - // word data allVerns: [], allWords: [], - recentWords: [], - // state management - defunctUpdates: {}, - defunctWordIds: {}, isFetchingFrontier: true, - senseSwitches: [], - // new entry state - newAudioUrls: [], - newGloss: "", - newNote: "", - newVern: "", - suggestedVerns: [], - suggestedDups: [], + ...defaultEntryTableState(), }); const levDist = useMemo(() => new LevenshteinDistance(), []); @@ -245,7 +254,7 @@ export default function DataEntryTable( // These are preferably non-async function that return void. //////////////////////////////////// - /*** Use this without newId before updating any word on the backend, + /** Use this without newId before updating any word on the backend, * to make sure that word doesn't get edited by two different functions. * Use this with newId to specify the replacement of a defunct word. */ @@ -273,7 +282,7 @@ export default function DataEntryTable( [state.defunctWordIds] ); - /*** Update a recent entry to a different sense of the same word. */ + /** Update a recent entry to a different sense of the same word. */ const switchSense = useCallback( (oldGuid: string, newGuid: string): void => { const entry = state.recentWords.find((w) => w.senseGuid === oldGuid); @@ -293,7 +302,7 @@ export default function DataEntryTable( [state.recentWords] ); - /*** Add to recent entries every sense of the word with the current semantic domain. */ + /** Add to recent entries every sense of the word with the current semantic domain. */ const addAllSensesToDisplay = useCallback( (word: Word): void => { const domId = props.semanticDomain.id; @@ -310,7 +319,7 @@ export default function DataEntryTable( [props.semanticDomain.id] ); - /*** Add one-sense word to the display of recent entries. */ + /** Add one-sense word to the display of recent entries. */ const addToDisplay = (wordAccess: WordAccess, insertIndex?: number): void => { setState((prevState) => { const recentWords = [...prevState.recentWords]; @@ -323,7 +332,7 @@ export default function DataEntryTable( }); }; - /*** Remove recent entry from specified index. */ + /** Remove recent entry from specified index. */ const removeRecentEntry = (index: number): void => { setState((prevState) => { const recentWords = prevState.recentWords.filter((_w, i) => i !== index); @@ -331,7 +340,7 @@ export default function DataEntryTable( }); }; - /*** Add a senseSwitch to the queue to be processed when possible. */ + /** Add a senseSwitch to the queue to be processed when possible. */ const queueSenseSwitch = (oldGuid: string, newGuid: string): void => { if (!oldGuid || !newGuid) { return; @@ -342,7 +351,7 @@ export default function DataEntryTable( }); }; - /*** Replace every displayed instance of a word. */ + /** Replace every displayed instance of a word. */ const replaceInDisplay = (oldId: string, word: Word): void => { setState((prevState) => { const recentWords = prevState.recentWords.map((a) => @@ -352,18 +361,12 @@ export default function DataEntryTable( }); }; - /*** Clear all new entry state elements. */ + /** Clear all new entry state elements. */ const resetNewEntry = (): void => { - setState((prevState) => ({ - ...prevState, - newAudioUrls: [], - newGloss: "", - newNote: "", - newVern: "", - })); + setState((prevState) => ({ ...prevState, ...defaultNewEntryState() })); }; - /*** Add an audio file to newAudioUrls. */ + /** Add an audio file to newAudioUrls. */ const addNewAudioUrl = (file: File): void => { setState((prevState) => { const newAudioUrls = [...prevState.newAudioUrls]; @@ -372,7 +375,7 @@ export default function DataEntryTable( }); }; - /*** Delete a url from newAudioUrls. */ + /** Delete a url from newAudioUrls. */ const delNewAudioUrl = (url: string): void => { setState((prevState) => { const newAudioUrls = prevState.newAudioUrls.filter((u) => u !== url); @@ -380,28 +383,28 @@ export default function DataEntryTable( }); }; - /*** Set the new entry gloss def. */ + /** Set the new entry gloss def. */ const setNewGloss = (gloss: string): void => { if (gloss !== state.newGloss) { setState((prev) => ({ ...prev, newGloss: gloss })); } }; - /*** Set the new entry note text. */ + /** Set the new entry note text. */ const setNewNote = (note: string): void => { if (note !== state.newNote) { setState((prev) => ({ ...prev, newNote: note })); } }; - /*** Set the new entry vernacular. */ + /** Set the new entry vernacular. */ const setNewVern = (vern: string): void => { if (vern !== state.newVern) { setState((prev) => ({ ...prev, newVern: vern })); } }; - /*** Set or clear the selected vern-duplicate word. */ + /** Set or clear the selected vern-duplicate word. */ const setSelectedDup = (id?: string): void => { setState((prev) => ({ ...prev, @@ -413,25 +416,11 @@ export default function DataEntryTable( })); }; - /*** Reset things specific to the current data entry session in the current semantic domain. */ + /** Reset things specific to the current data entry session in the current semantic domain. */ const resetEverything = (): void => { props.openTree(); props.hideQuestions(); - setState((prevState) => ({ - ...prevState, - defunctUpdates: {}, - defunctWordIds: {}, - recentWords: [], - senseSwitches: [], - // new entry state: - newAudioUrls: [], - newGloss: "", - newNote: "", - newVern: "", - selectedDup: undefined, - suggestedDups: [], - suggestedVerns: [], - })); + setState((prevState) => ({ ...prevState, ...defaultEntryTableState() })); }; //////////////////////////////////// @@ -439,12 +428,12 @@ export default function DataEntryTable( // These cannot be async, so use asyncFunction().then(...) as needed. //////////////////////////////////// - /*** Trigger a parent height update if the number of recent entries changes. */ + /** Trigger a parent height update if the number of recent entries changes. */ useEffect(() => { updateHeight(); }, [state.recentWords.length, updateHeight]); - /*** Manages the senseSwitches queue. */ + /** Manages the senseSwitches queue. */ useEffect(() => { if (!state.senseSwitches.length) { return; @@ -460,7 +449,7 @@ export default function DataEntryTable( switchSense(oldGuid, newGuid); }, [switchSense, state.recentWords, state.senseSwitches]); - /*** Manages fetching the frontier. + /** Manages fetching the frontier. * This is the ONLY place to update allWords and allVerns * or to switch isFetchingFrontier to false. */ useEffect(() => { @@ -499,7 +488,7 @@ export default function DataEntryTable( } }, [state.isFetchingFrontier]); - /*** If vern-autocomplete is on for the project, make list of all vernaculars. */ + /** If vern-autocomplete is on for the project, make list of all vernaculars. */ useEffect(() => { setState((prev) => ({ ...prev, @@ -509,7 +498,7 @@ export default function DataEntryTable( })); }, [state.allWords, suggestVerns]); - /*** Act on the defunctUpdates queue. */ + /** Act on the defunctUpdates queue. */ useEffect(() => { const ids = Object.keys(state.defunctUpdates); if (!ids.length) { @@ -531,7 +520,7 @@ export default function DataEntryTable( } }, [state.defunctUpdates, state.recentWords]); - /*** Update vern suggestions. */ + /** Update vern suggestions. */ useEffect(() => { if (!suggestVerns) { return; @@ -563,7 +552,7 @@ export default function DataEntryTable( // After the update, defunctWord(updatedWord.id). //////////////////////////////////// - /*** Given an array of audio file urls, add them all to specified word. */ + /** Given an array of audio file urls, add them all to specified word. */ const addAudiosToBackend = useCallback( async (oldId: string, audioURLs: string[]): Promise => { if (!audioURLs.length) { @@ -580,7 +569,7 @@ export default function DataEntryTable( [defunctWord] ); - /*** Given a single audio file, add to specified word. */ + /** Given a single audio file, add to specified word. */ const addAudioFileToWord = useCallback( async (oldId: string, audioFile: File): Promise => { defunctWord(oldId); @@ -590,7 +579,7 @@ export default function DataEntryTable( [defunctWord] ); - /*** Add a word determined to be a duplicate. + /** Add a word determined to be a duplicate. * Ensures the updated word has representation in the display. * Note: Only for use after backend.getDuplicateId(). */ @@ -612,7 +601,7 @@ export default function DataEntryTable( [addAllSensesToDisplay, addAudiosToBackend, defunctWord, state.recentWords] ); - /*** Deletes specified audio file from specified word. */ + /** Deletes specified audio file from specified word. */ const deleteAudioFromWord = useCallback( async (oldId: string, fileName: string): Promise => { defunctWord(oldId); @@ -622,7 +611,7 @@ export default function DataEntryTable( [defunctWord] ); - /*** Updates word. */ + /** Updates word. */ const updateWordInBackend = useCallback( async (word: Word): Promise => { defunctWord(word.id); @@ -637,7 +626,7 @@ export default function DataEntryTable( // General async functions. ///////////////////////////////// - /*** Add a new word to the project, or update if new word is a duplicate. */ + /** Add a new word to the project, or update if new word is a duplicate. */ const addNewWord = useCallback( async ( wordToAdd: Word, @@ -662,7 +651,7 @@ export default function DataEntryTable( [addAudiosToBackend, addDuplicateWord, analysisLang.bcp47] ); - /*** Update the word in the backend and the frontend. */ + /** Update the word in the backend and the frontend. */ const updateWordBackAndFront = async ( wordToUpdate: Word, senseGuid: string, @@ -676,7 +665,7 @@ export default function DataEntryTable( addToDisplay({ word, senseGuid }); }; - /*** Reset the entry table. If there is an un-submitted word then submit it. */ + /** Reset the entry table. If there is an un-submitted word then submit it. */ const handleExit = async (): Promise => { // Check if there is a new word, but user exited without pressing enter. if (state.newVern) { @@ -698,7 +687,7 @@ export default function DataEntryTable( // Async functions for handling changes of the NewEntry. ///////////////////////////////// - /*** Assemble a word from the new entry state and add it. */ + /** Assemble a word from the new entry state and add it. */ const addNewEntry = async (): Promise => { const word = newWord(state.newVern); const lang = analysisLang.bcp47; @@ -709,7 +698,7 @@ export default function DataEntryTable( await addNewWord(word, state.newAudioUrls); }; - /*** Checks if sense already exists with this gloss and semantic domain. */ + /** Checks if sense already exists with this gloss and semantic domain. */ const updateWordWithNewEntry = async (wordId: string): Promise => { const oldWord = state.allWords.find((w: Word) => w.id === wordId); if (!oldWord) { @@ -757,7 +746,7 @@ export default function DataEntryTable( // Async functions for handling changes of a RecentEntry. ///////////////////////////////// - /*** Retract a recent entry. */ + /** Retract a recent entry. */ const undoRecentEntry = useCallback( async (eIndex: number): Promise => { const { word, senseGuid } = state.recentWords[eIndex]; @@ -793,7 +782,7 @@ export default function DataEntryTable( ] ); - /*** Update the vernacular in a recent entry. */ + /** Update the vernacular in a recent entry. */ const updateRecentVern = useCallback( async ( index: number, @@ -824,7 +813,7 @@ export default function DataEntryTable( [addNewWord, state.recentWords, undoRecentEntry, updateWordInBackend] ); - /*** Update the gloss def in a recent entry. */ + /** Update the gloss def in a recent entry. */ const updateRecentGloss = useCallback( async (index: number, def: string): Promise => { const oldEntry = state.recentWords[index]; @@ -852,7 +841,7 @@ export default function DataEntryTable( const handleFocusNewEntry = useCallback(() => focusInput(newVernInput), []); - /*** Update the note text in a recent entry. */ + /** Update the note text in a recent entry. */ const updateRecentNote = useCallback( async (index: number, text: string): Promise => { const oldWord = state.recentWords[index].word; diff --git a/src/components/LandingPage/index.tsx b/src/components/LandingPage/index.tsx index fc88991ac1..b413489036 100644 --- a/src/components/LandingPage/index.tsx +++ b/src/components/LandingPage/index.tsx @@ -1,5 +1,5 @@ import { Box, Grid, Hidden, Typography } from "@mui/material"; -import React, { ReactElement, useEffect } from "react"; +import { ReactElement, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; @@ -28,7 +28,7 @@ export default function LandingPage(): ReactElement { navigate(Path.Root); }, [navigate]); return ( - + <> @@ -58,7 +58,7 @@ export default function LandingPage(): ReactElement { - + ); } @@ -66,7 +66,7 @@ function Body(): ReactElement { const { t } = useTranslation(); return ( - + <>
{t("landingPage.descriptionP1")} @@ -100,6 +100,6 @@ function Body(): ReactElement { marginTop: theme.spacing(4), }} /> - + ); } diff --git a/src/components/ProjectScreen/CreateProjectActions.ts b/src/components/ProjectScreen/CreateProjectActions.ts index 1c6a3c2e85..7270655fc4 100644 --- a/src/components/ProjectScreen/CreateProjectActions.ts +++ b/src/components/ProjectScreen/CreateProjectActions.ts @@ -9,7 +9,7 @@ import { newProject } from "types/project"; // Dispatch Functions -/*** Create a project without an import. */ +/** Create a project without an import. */ export function asyncCreateProject( name: string, vernacularWritingSystem: WritingSystem, @@ -31,7 +31,7 @@ export function asyncCreateProject( }; } -/*** Create a project with a pre-uploaded import. */ +/** Create a project with a pre-uploaded import. */ export function asyncFinishProject( name: string, vernacularWritingSystem: WritingSystem diff --git a/src/components/ProjectSettings/ProjectSchedule/index.tsx b/src/components/ProjectSettings/ProjectSchedule/index.tsx index 3839efabbf..9db44c07c8 100644 --- a/src/components/ProjectSettings/ProjectSchedule/index.tsx +++ b/src/components/ProjectSettings/ProjectSchedule/index.tsx @@ -42,7 +42,7 @@ export default function ProjectSchedule( const schedule = props.project.workshopSchedule?.map((d) => new Date(d)) ?? []; setProjectSchedule(schedule); - }, [props.project.workshopSchedule, setProjectSchedule]); + }, [props.project.workshopSchedule]); useEffect(() => { // Every time a modal is closed, fetch the updated schedule. diff --git a/src/components/ProjectUsers/EmailInvite.tsx b/src/components/ProjectUsers/EmailInvite.tsx index 4ddc5fe9a9..3a8cef799c 100644 --- a/src/components/ProjectUsers/EmailInvite.tsx +++ b/src/components/ProjectUsers/EmailInvite.tsx @@ -44,7 +44,7 @@ export default function EmailInvite(props: InviteProps): ReactElement { useEffect(() => { setIsValid(validator.isEmail(email) && email !== "example@gmail.com"); - }, [email, setIsValid]); + }, [email]); return ( diff --git a/src/components/ProjectUsers/UserList.tsx b/src/components/ProjectUsers/UserList.tsx index 669be20171..140e7196de 100644 --- a/src/components/ProjectUsers/UserList.tsx +++ b/src/components/ProjectUsers/UserList.tsx @@ -47,7 +47,7 @@ export default function UserList(props: UserListProps): ReactElement { const projUserIds = props.projectUsers.map((u) => u.id); setNonProjUsers(users.filter((u) => !projUserIds.includes(u.id))); }); - }, [props.projectUsers, setNonProjUsers]); + }, [props.projectUsers]); useEffect(() => { const newUserAvatar: Hash = {}; @@ -57,7 +57,7 @@ export default function UserList(props: UserListProps): ReactElement { } }); Promise.all(promises).then(() => setUserAvatar(newUserAvatar)); - }, [props.projectUsers, setUserAvatar]); + }, [props.projectUsers]); const updateUsers = (text: string): void => { setFilterInput(text); diff --git a/src/components/SiteSettings/UserManagement/UserList.tsx b/src/components/SiteSettings/UserManagement/UserList.tsx index eb80301c37..c6de593514 100644 --- a/src/components/SiteSettings/UserManagement/UserList.tsx +++ b/src/components/SiteSettings/UserManagement/UserList.tsx @@ -48,7 +48,7 @@ export default function UserList(props: UserListProps): ReactElement { useEffect(() => { setSortedUsers([...filteredUsers].sort(compareUsers)); - }, [compareUsers, filteredUsers, setFilteredUsers]); + }, [compareUsers, filteredUsers]); useEffect(() => { const newUserAvatar: Hash = {}; @@ -58,7 +58,7 @@ export default function UserList(props: UserListProps): ReactElement { } }); Promise.all(promises).then(() => setUserAvatar(newUserAvatar)); - }, [props.allUsers, setUserAvatar]); + }, [props.allUsers]); useEffect(() => { setFilteredUsers( diff --git a/src/components/SiteSettings/UserManagement/index.tsx b/src/components/SiteSettings/UserManagement/index.tsx index 20ecf8e5b7..bfff55a4c7 100644 --- a/src/components/SiteSettings/UserManagement/index.tsx +++ b/src/components/SiteSettings/UserManagement/index.tsx @@ -34,7 +34,7 @@ export default function UserManagement(): ReactElement { console.error(err); toast.error(t("siteSettings.populateUsers.toastFailure")); }); - }, [setAllUsers, t]); + }, [t]); useEffect(() => { Modal.setAppElement("body"); diff --git a/src/components/TreeView/TreeDepiction/TreeTile.tsx b/src/components/TreeView/TreeDepiction/TreeTile.tsx index d3a343bbec..2d393522a2 100644 --- a/src/components/TreeView/TreeDepiction/TreeTile.tsx +++ b/src/components/TreeView/TreeDepiction/TreeTile.tsx @@ -5,7 +5,7 @@ interface TreeTileProps { colWidth: number; imgSrc: string; } -/*** Creates a section of the tree diagram (one of the branches) set to proper dimensions. */ +/** Creates a section of the tree diagram (one of the branches) set to proper dimensions. */ export default function TreeTile(props: TreeTileProps): ReactElement { return ( diff --git a/src/goals/DefaultGoal/Loading.tsx b/src/goals/DefaultGoal/Loading.tsx index 61245e2e80..abdbaf2ef7 100644 --- a/src/goals/DefaultGoal/Loading.tsx +++ b/src/goals/DefaultGoal/Loading.tsx @@ -1,6 +1,6 @@ import { Typography } from "@mui/material"; import { animate } from "motion"; -import React, { ReactElement, useEffect } from "react"; +import { ReactElement, useEffect } from "react"; import { useTranslation } from "react-i18next"; import tractor from "resources/tractor.png"; @@ -19,7 +19,7 @@ export default function Loading(): ReactElement { }, []); return ( - + <> {t("generic.loadingTitle")} @@ -32,6 +32,6 @@ export default function Loading(): ReactElement { {t("generic.loadingText")} - + ); } diff --git a/src/goals/MergeDuplicates/MergeDupsCompleted.tsx b/src/goals/MergeDuplicates/MergeDupsCompleted.tsx index 0f9dfbf308..802bdeaa2c 100644 --- a/src/goals/MergeDuplicates/MergeDupsCompleted.tsx +++ b/src/goals/MergeDuplicates/MergeDupsCompleted.tsx @@ -111,12 +111,13 @@ interface WordPaperProps { function WordPaper(props: WordPaperProps): ReactElement { const [word, setWord] = useState(); const [flag, setFlag] = useState(newFlag()); + useEffect(() => { getWord(props.wordId).then(setWord); - }, [props.wordId, setWord]); + }, [props.wordId]); useEffect(() => { setFlag(word?.flag ?? newFlag()); - }, [word, setFlag]); + }, [word]); return ( diff --git a/src/goals/ReviewEntries/ReviewEntriesTable/index.tsx b/src/goals/ReviewEntries/ReviewEntriesTable/index.tsx index ff4579f341..ca85451581 100644 --- a/src/goals/ReviewEntries/ReviewEntriesTable/index.tsx +++ b/src/goals/ReviewEntries/ReviewEntriesTable/index.tsx @@ -80,7 +80,7 @@ export default function ReviewEntriesTable( } return { pageSize: options[i], pageSizeOptions: options }; }); - }, [maxRows, setPageState]); + }, [maxRows]); useEffect(() => { // onRowsPerPageChange={() => window.scrollTo({ top: 0 })} doesn't work.