Skip to content

Commit

Permalink
fix(wanings): fix some eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiaraujo012 committed Aug 10, 2024
1 parent f5a4a14 commit 1292c5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dev": "vite build --watch",
"build": "rimraf ./dist && tsc && vite build && publint --strict",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --ext ts,tsx --fix",
"cipublish": "node scripts/publish.js"
},
"keywords": [
Expand Down
7 changes: 4 additions & 3 deletions src/components/AutocompleteController.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Autocomplete, CircularProgress, TextField } from '@mui/material';
import { Controller, useController } from 'react-hook-form';
import {
useAsyncFieldControllerLabels,
useFieldControllerLabels,
useFieldControllerWithOptionsLabels,
useOnErrorMessage,
} from '../hooks/index';
import { useController } from 'react-hook-form';
import { useEffect, useState } from 'react';
import type {
AsyncFieldControllerProps,
Expand Down Expand Up @@ -91,8 +91,8 @@ export const AutocompleteController = <
field: { onChange, value, ...other },
fieldState: { invalid, error },
} = useController({
name,
control,
name,
});

/**
Expand All @@ -101,11 +101,12 @@ export const AutocompleteController = <
useEffect(() => {
if (value) {
const optionFound = options.find((option) => optionValueAccessor(option) === value);

if (optionFound) {
setSelectedValue(optionFound as AutocompleteValue<Value, Multiple, DisableClearable, FreeSolo> | null);
}
}
}, [value]);
}, [value, optionValueAccessor, options]);

/**
* Render
Expand Down

0 comments on commit 1292c5f

Please sign in to comment.