From 15d72c53334452307d0301182adff270f805e8d5 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 9 Mar 2021 17:20:55 +0400 Subject: [PATCH] fix react-hooks/exhaustive-deps issues --- .github/workflows/main.yml | 1 + README.md | 2 +- package.json | 3 +++ src/components/VerbFormDisplay.tsx | 6 +++++- src/components/verb-info/VerbInfoItemDisplay.tsx | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11e1754..dea52fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest env: LINGDOCS_DICTIONARY_URL: ${{ secrets.LINGDOCS_DICTIONARY_URL }} + LINGDOCS_NPM_TOKEN: ${{ secrets.LINGDOCS_NPM_TOKEN }} strategy: matrix: node-version: [12.x, 14.x, 15.x] diff --git a/README.md b/README.md index 98bd2f6..9ab2b46 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ yarn start ### Website -To build the Pashto [Pashto Verb Explorer](https://verbs.lingdocs.com) website: +To build the [Pashto Verb Explorer](https://verbs.lingdocs.com) website: ``` yarn build-website diff --git a/package.json b/package.json index 25c02fa..b899163 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "type": "git", "url": "https://github.com/lingdocs/pashto-inflector.git" }, + "publishConfig": { + "registry":"https://reg.lingdocs.com" + }, "dependencies": { "classnames": "^2.2.6" }, diff --git a/src/components/VerbFormDisplay.tsx b/src/components/VerbFormDisplay.tsx index 4751aa1..37b5832 100644 --- a/src/components/VerbFormDisplay.tsx +++ b/src/components/VerbFormDisplay.tsx @@ -60,7 +60,11 @@ function VerbFormDisplay({ displayForm, textOptions, info, showingFormInfo, engl if (length === "mini" && !("mini" in chosenPersInf)) { setLength("long"); } - setPersInf("mascSing"); + // setPersInf("mascSing"); + setShowingExplanation(false); + }, [block, length, chosenPersInf]); + // TODO: This could be handled better to avoid the react-hooks/exhaustive-deps warning ? + useEffect(() => { setShowingExplanation(false); }, [block]); const hasVariations = (!("masc" in form)) && (!("p" in form)) && (!isSentenceForm(form)) && !isAllOne(form as T.VerbBlock | T.ImperativeBlock); diff --git a/src/components/verb-info/VerbInfoItemDisplay.tsx b/src/components/verb-info/VerbInfoItemDisplay.tsx index f4aa5ff..0cb62d0 100644 --- a/src/components/verb-info/VerbInfoItemDisplay.tsx +++ b/src/components/verb-info/VerbInfoItemDisplay.tsx @@ -27,7 +27,7 @@ function VerbInfoItemDisplay({ item, textOptions, tails }: { : x ); useEffect(() => { - setLength((length === "mini" && !("mini" in item)) ? "short" : length); + setLength(l => (l === "mini" && !("mini" in item)) ? "short" : l); }, [item]); // const lengthsAvailable = "long" in item // ? [...["long", "short"], ..."mini" in item ? ["mini"] : []]