Bug 903791 - StartGroup and EndGroup

Hello.

Have you been able to resolve Bug #903791?

I'm encountering an issue with the if clause:

if (entry.type === 'EndGroup' && diagram.historyManager.currentEntry.type === 'StartGroup')

The following error appears:

ERROR TypeError: Cannot read properties of undefined (reading 'type') at UndoRedo.addHistoryEntry

Maybe replacing it with:

if (entry?.type === 'EndGroup' && diagram?.historyManager?.currentEntry?.type === 'StartGroup')

could be the solution.

Thank you!




8 Replies

DP Dhakshin Prasath Dhanraj Syncfusion Team December 19, 2024 06:10 AM UTC

Hi,

We are unable to understand the details you provided regarding the issue. Could you please provide more information about the issue and
 the ID (903791) you mentioned in your query is not a valid feedback or support id.

Regards,

Dhakshin




LG Lucas Gagenten December 26, 2024 12:32 PM UTC

Hello.

I was getting an error in the following if clause on your code, and it is mentioning the bug 903791:

UndoRedo.prototype.addHistoryEntry = function (entry, diagram) {
// Bug: 903791-remove StartGroup & EndGroup entry when no actual changes wrapped between them.
if (entry.type === 'EndGroup' && diagram.historyManager.currentEntry.type === 'StartGroup') {
if (diagram.historyManager.currentEntry.previous) {
diagram.historyManager.currentEntry.previous.next = undefined;
}
diagram.historyManager.currentEntry = diagram.historyManager.currentEntry.previous;
// when cancelled change startGroup is only entry in history manager
if (!diagram.historyManager.currentEntry) {
diagram.historyManager.canUndo = false;
}
return false;
}
var entryObject = null;
var nextEntry = null;
....


DP Dhakshin Prasath Dhanraj Syncfusion Team December 27, 2024 06:42 AM UTC

Hi,

We have received a support ticket from your account. Could you please confirm if both ticket and forum have same query? If not, kindly provide the sample and the replication procedure for the issue.

Regards,
Dhakshin



LG Lucas Gagenten December 27, 2024 11:06 AM UTC

Unfortunately, I cannot reproduce the same error, but I have been able to reproduce similar ones. In the following example, 

https://stackblitz.com/edit/syncfusion-diagram-historymanager-undo-redo-lzznlkzc

if you click JOIN, then click UNDO twice, and then click REDO once, the following error appears: 

ERROR TypeError: Cannot read properties of null 
    at UndoRedo.redoGroupAction
    at UndoRedo.redo
    at Diagram.redo

And if you enter this example:

https://stackblitz.com/edit/syncfusion-diagram-historymanager-undo-redo-7mjsztpa

just click JOIN and then click UNDO to see this other error:

ERROR TypeError: Cannot read properties of null (reading 'type')
    at UndoRedo.undoGroupAction
    at UndoRedo.undo
    at Diagram.undo

All these errors originate from the use of the HistoryManager and are not related to ticket #675038.




DP Dhakshin Prasath Dhanraj Syncfusion Team December 30, 2024 12:04 PM UTC

Hi, 

We will validate the issues and get back to you soon.

Regards,
Dhakshin



DP Dhakshin Prasath Dhanraj Syncfusion Team January 8, 2025 05:42 AM UTC

Hi,

We provided a solution during the meeting held on January 7, 2025. Could you please confirm whether that solution resolved the issue? If not, kindly provide us with an update.

Regards,

Dhakshin




LG Lucas Gagenten January 9, 2025 01:47 PM UTC

Hello. 
This error is not related to our meeting on January 7.

Check what a wrote on December 27, 2024.

Regards.



DP Dhakshin Prasath Dhanraj Syncfusion Team January 10, 2025 01:08 PM UTC

Hi,

We have validated the issue you mentioned using the samples you provided. During our review, we noticed the following:

  • The startGroupAction method is called twice in Sample 1.
  • The endGroupAction method is called twice in Sample 2.

To address this, we have modified the samples by removing the redundant method calls and added logic to restrict undo and redo actions while executing join method actions.

Please refer to the updated samples below for your reference:

Sample 1: Undo/Redo Issue Fix - Group Action Start

Sample 2: Undo/Redo Issue Fix - Group Action End

Regards,

Dhakshin


Loader.
Up arrow icon