Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

fix: dependency warnings in useEffectHooks #21

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/console/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function Console() {
} catch (err) {
setError(err instanceof Error ? err : Error(String(err)));
}
}, []);
}, [clearError, setError]);

const handleSubmit = (values: IConsole) => {
const { flagKey, entityId, context } = values;
Expand Down
4 changes: 2 additions & 2 deletions src/app/flags/Evaluation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default function Evaluation() {
});

setRules(rules);
}, [rulesVersion]);
}, [flag]);

const incrementRulesVersion = () => {
setRulesVersion(rulesVersion + 1);
Expand Down Expand Up @@ -156,7 +156,7 @@ export default function Evaluation() {

useEffect(() => {
loadData();
}, [rulesVersion]);
}, [loadData, rulesVersion]);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/app/flags/Flag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Flag() {
.catch((err) => {
setError(err);
});
}, [flagVersion]);
}, [clearError, flag.key, setError]);

const incrementFlagVersion = () => {
setFlagVersion(flagVersion + 1);
Expand Down
2 changes: 1 addition & 1 deletion src/app/flags/Flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Flags() {
return;
}
clearError();
}, error);
}, [clearError, error, setError]);

return (
<>
Expand Down
8 changes: 4 additions & 4 deletions src/app/segments/Segment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function Segment() {
const navigate = useNavigate();

const [segment, setSegment] = useState<ISegment>(useLoaderData() as ISegment);
const [segmentVerison, setSegmentVersion] = useState(0);
const [segmentVersion, setSegmentVersion] = useState(0);

const [showConstraintForm, setShowConstraintForm] = useState<boolean>(false);
const [editingConstraint, setEditingConstraint] =
Expand All @@ -60,15 +60,15 @@ export default function Segment() {
.catch((err) => {
setError(err);
});
}, [segmentVerison]);
}, [clearError, segment.key, setError]);

const incrementSegmentVersion = () => {
setSegmentVersion(segmentVerison + 1);
setSegmentVersion(segmentVersion + 1);
};

useEffect(() => {
fetchSegment();
}, [segmentVerison, fetchSegment]);
}, [segmentVersion, fetchSegment]);

const constraintTypeToLabel = (t: string) =>
ComparisonType[t as keyof typeof ComparisonType];
Expand Down
2 changes: 1 addition & 1 deletion src/app/segments/Segments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function Segments() {
return;
}
clearError();
}, error);
}, [clearError, error, setError]);

return (
<>
Expand Down