Fixed backup item method by using a deep clone

This commit is contained in:
Thorsten Sommer 2025-05-24 18:29:58 +02:00
parent c4a56f969f
commit b7c06588b7
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -125,19 +125,16 @@ public partial class ChatTemplateDialog : MSGComponentBase
}
}
private void BackupItem(object element)
private void BackupItem(object? element)
{
this.messageEntryBeforeEdit = new ContentBlock
this.isInlineEditOnGoing = true;
this.messageEntryBeforeEdit = element switch
{
Role = ((ContentBlock)element).Role,
Content = ((ContentBlock)element).Content,
ContentBlock block => block.DeepClone(),
_ => null,
};
}
{
((ContentBlock)element).Role = this.messageEntryBeforeEdit.Role;
((ContentBlock)element).Content = this.messageEntryBeforeEdit.Content;
this.StateHasChanged();
}
#region Overrides of ComponentBase