Skip to content

Commit

Permalink
fix: useState and useEffect remove from condicional
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian7489 committed Oct 16, 2024
1 parent 00598f7 commit 35c07e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/admin/asset/assetForm/asset-info/field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import SelectCustom from "@/components/ui/select-custom";
import SearchableSelect from "@/components/ui/select-searchable";

const RenderField = ({ input, handleChangeInput, assetEdit }) => {
if (input.type === "select") {
const [inputOptions, setInputOptions] = useState([]);
const [inputOptions, setInputOptions] = useState([]);

useEffect(() => {
useEffect(() => {
if (input.optionsURL) {
fetch(input.optionsURL)
.then((response) => response.text())
.then((csvData) => {
Expand All @@ -19,8 +19,10 @@ const RenderField = ({ input, handleChangeInput, assetEdit }) => {
.catch((error) => {
console.error("Error fetching CSV:", error);
});
}, []);
}
}, []);

if (input.type === "select") {
return (
<>
<Label className="pt-3" htmlFor={`extras.${input._id}`}>
Expand Down

0 comments on commit 35c07e7

Please sign in to comment.