using states in event callbacks like selectionChange

Hi,

I'm using functionnal component with hooks with the DocumentEditorComponent.

I need to use events selectionChange and contentChange, but the functions called for these events haven't the refreshed state value, 
instead, it has the state value when the callback is set to the event.

I've built a quick example with the selectionChange event:
https://stackblitz.com/edit/react-n1rnfi?devtoolsheight=33&file=index.js

I need to have the current state value in these callbacks.
any idea to do that?

I'm maybe wrong, but I think I hadn't this problem in previous versions of the document editor

Regards,
François

5 Replies 1 reply marked as answer

RC Richard Craig November 6, 2020 03:39 PM UTC

I've just filed an incident as it appears no components are working with state at the moment, they always use the initial state value.


HC Harini Chellappa Syncfusion Team November 9, 2020 12:28 PM UTC

Hi François, 
 
Currently, we are checking on this. Will update further details on Nov 11, 2020. 
 
Regards, 
 
Harini C 



FR François November 10, 2020 06:59 PM UTC

Hi,

Here is a workaround with useEffect:
https://stackblitz.com/edit/react-n1rnfi-pjjiyf?file=index.js


HC Harini Chellappa Syncfusion Team November 11, 2020 02:10 PM UTC

Hi François, 
 
We have considered the reported “state change not reflecting issue” as a bug and fix will be included in our November 25, 2020 patch release. Once included, will update you. You can track the status from below link. 
 
 
Regards, 
 
Harini C 



HC Harini Chellappa Syncfusion Team November 30, 2020 07:33 AM UTC

Hi François, 
 
Thank you for waiting for our response. 
We are glad that the reported issue is fixed with our latest patch release version “18.3.50” and we request you to upgrade your Syncfusion react packages to latest. 
 
 
Please get back to us if you have any queries. 
 
Regards, 
 
Harini C 


Marked as answer
Loader.
Up arrow icon