Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(polls) fix answer editing bug causing unintended removal

Mohammed Abdul Razak Wahabf5ab10cfbab4
diff --git a/react/features/polls/components/AbstractPollCreate.tsx b/react/features/polls/components/AbstractPollCreate.tsx
index d59ce32475..dbd4cdfdc0 100644
--- a/react/features/polls/components/AbstractPollCreate.tsx
+++ b/react/features/polls/components/AbstractPollCreate.tsx
@@ -46,9 +46,13 @@ const AbstractPollCreate = (Component: ComponentType<AbstractProps>) => (props:
const [ answers, setAnswers ] = useState([ '', '' ]);
const setAnswer = useCallback((i, answer) => {
- answers[i] = answer;
+ setAnswers(currentAnswers => {
+ const newAnswers = [ ...currentAnswers ];
- setAnswers([ ...answers ]);
+ newAnswers[i] = answer;
+
+ return newAnswers;
+ });
}, [ answers ]);
const addAnswer = useCallback((i?: number) => {