fix react-hooks/exhaustive-deps issues

This commit is contained in:
lingdocs 2021-03-09 17:20:55 +04:00
parent fd9b80a2cc
commit 15d72c5333
5 changed files with 11 additions and 3 deletions

View File

@ -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]

View File

@ -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

View File

@ -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"
},

View File

@ -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);

View File

@ -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"] : []]