mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: github linting warnings (#1852)
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
This commit is contained in:
committed by
GitHub
parent
d3e0e67bd9
commit
1f79416367
@@ -55,7 +55,7 @@ export default function MultipleChoiceMultiQuestion({
|
||||
setOtherValue(
|
||||
(Array.isArray(value) && value.filter((v) => !question.choices.find((c) => c.label === v))[0]) || ""
|
||||
);
|
||||
}, [question.id]);
|
||||
}, [question.id, getChoicesWithoutOtherLabels, question.choices, value]);
|
||||
|
||||
const questionChoices = useMemo(() => {
|
||||
if (!question.choices) {
|
||||
|
||||
@@ -57,8 +57,9 @@ export default function MultipleChoiceSingleQuestion({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setOtherSelected(!!value && !question.choices.find((c) => c.label === value));
|
||||
}, [question.id]);
|
||||
const isOtherSelected = value !== undefined && !question.choices.some((choice) => choice.label === value);
|
||||
setOtherSelected(isOtherSelected);
|
||||
}, [question.id, question.choices, value]);
|
||||
|
||||
const otherSpecify = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
|
||||
@@ -47,11 +47,11 @@ export default function OpenTextQuestion({
|
||||
};
|
||||
const openTextRef = useCallback(
|
||||
(currentElement: HTMLInputElement | HTMLTextAreaElement | null) => {
|
||||
if (currentElement && autoFocus) {
|
||||
if (question.id && currentElement && autoFocus) {
|
||||
currentElement.focus();
|
||||
}
|
||||
},
|
||||
[question.id]
|
||||
[question.id, autoFocus]
|
||||
);
|
||||
const isInputEmpty = (value: string) => {
|
||||
return question.required && !value?.trim();
|
||||
|
||||
@@ -27,7 +27,7 @@ export const useTtc = (
|
||||
) => {
|
||||
useEffect(() => {
|
||||
setStartTime(performance.now());
|
||||
}, [questionId]);
|
||||
}, [questionId, setStartTime]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleVisibilityChange = () => {
|
||||
@@ -47,5 +47,5 @@ export const useTtc = (
|
||||
// Clean up the event listener when the component is unmounted
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
};
|
||||
}, []);
|
||||
}, [questionId, setStartTime, setTtc, startTime, ttc]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user