fix: survey preview updation issues (#3269)

This commit is contained in:
Dhruwang Jariwala
2024-10-03 23:05:24 +05:30
committed by GitHub
parent ea0df287d9
commit 21e9e9167f

View File

@@ -54,6 +54,11 @@ export const Survey = ({
}: SurveyBaseProps) => {
const [localSurvey, setlocalSurvey] = useState<TSurvey>(survey);
// Update localSurvey when the survey prop changes (it changes in case of survey editor)
useEffect(() => {
setlocalSurvey(survey);
}, [survey]);
const autoFocusEnabled = autoFocus !== undefined ? autoFocus : window.self === window.top;
const [questionId, setQuestionId] = useState(() => {