From bf19ccee9b98b440e3d982b104b27cd7a85992f9 Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Wed, 30 Apr 2025 15:42:15 +0200
Subject: [PATCH] next try with deepcopy instead of shallow copy
---
frontend/src/pages/TransactionLink.vue | 29 ++++++++++----------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/frontend/src/pages/TransactionLink.vue b/frontend/src/pages/TransactionLink.vue
index 3e9f84cba..cf99b8f26 100644
--- a/frontend/src/pages/TransactionLink.vue
+++ b/frontend/src/pages/TransactionLink.vue
@@ -240,13 +240,10 @@ onError(() => {
function setTransactionLinkInformation() {
console.log('TransactionLink.setTransactionLinkInformation... result=', result.value)
- const { queryTransactionLink } = result.value
- console.log(
- 'TransactionLink.setTransactionLinkInformation... queryTransactionLink=',
- queryTransactionLink,
- )
- if (queryTransactionLink) {
- linkData.value = queryTransactionLink
+ const deepCopy = JSON.parse(JSON.stringify(result.value))
+ console.log('TransactionLink.setTransactionLinkInformation... deepCopy=', deepCopy)
+ if (deepCopy) {
+ linkData.value = deepCopy
console.log('TransactionLink.setTransactionLinkInformation... linkData.value=', linkData.value)
if (linkData.value.__typename === 'ContributionLink' && store.state.token) {
console.log('TransactionLink.setTransactionLinkInformation... typename === ContributionLink')
@@ -258,16 +255,12 @@ function setTransactionLinkInformation() {
function setRedeemJwtLinkInformation() {
console.log('TransactionLink.setRedeemJwtLinkInformation... result=', result.value)
- // Make a shallow copy to break reactivity/read-only
- const queryTransactionLink = { ...result.value }
- console.log(
- 'TransactionLink.setRedeemJwtLinkInformation... queryTransactionLink=',
- queryTransactionLink,
- )
- if (queryTransactionLink) {
+ const deepCopy = JSON.parse(JSON.stringify(result.value))
+ console.log('TransactionLink.setRedeemJwtLinkInformation... deepCopy=', deepCopy)
+ if (deepCopy) {
// recipientUser is only set if the user is logged in
if (store.state.gradidoID !== null) {
- queryTransactionLink.recipientUser = {
+ deepCopy.recipientUser = {
__typename: 'User',
gradidoID: store.state.gradidoID,
firstName: store.state.firstName,
@@ -276,16 +269,16 @@ function setRedeemJwtLinkInformation() {
}
console.log(
'TransactionLink.setRedeemJwtLinkInformation... recipientUser=',
- queryTransactionLink.recipientUser,
+ deepCopy.recipientUser,
)
- linkData.value = { ...queryTransactionLink }
+ linkData.value = deepCopy
console.log('TransactionLink.setRedeemJwtLinkInformation... linkData.value=', linkData.value)
}
}
async function mutationLink(amount) {
console.log('TransactionLink.mutationLink... params=', params)
- if (isDisbursementLink.value) {
+ if (isRedeemJwtLink.value) {
console.log('TransactionLink.mutationLink... trigger disbursement from recipient-community')
try {
await disburseMutate({