Open JakeCoxon opened 7 months ago
Hello @JakeCoxon,
I put debugger
within the onPartialSend
function and confirmed that this function is invoked when the navigating to the next survey page. Please let me know whether you have any difficulties using the onPartialSend
function.
For the record: we may also recommend sending survey responses within the current page changed callback function. Please refer to the following demo: Continue an Incomplete Survey.
Are you requesting a feature, reporting a bug or asking a question?
Reporting a bug
What is the current behavior?
When Survey is remounted it modifies the SurveyModel and removes all onPartialSend callbacks
https://github.com/surveyjs/survey-library/blob/ddb86f54443a34ad4a369517d7f2f16e50e1fe4e/src/react/reactSurvey.tsx#L74C1-L74C41
When using React.StrictMode the SurveyComponent gets remounted automatically. But this will happen in other unmounting cases
What is the expected behavior?
I understand that line is supposed to remove the callback added elsewhere in the file, I would expect my existing callbacks to be remain.
How would you reproduce the current behavior (if this is a bug)?
Load the page below and you will see two renders and the useEffect will say the function is no longer in the event listener
And if you try pressing the next button it does not call the callback.
Provide the test code and the tested page URL (if applicable)
https://codesandbox.io/p/sandbox/determined-moon-6fljq5?file=%2Fsrc%2FSurveyComponent.jsx%3A8%2C1
Specify your