fix: remove Svelte 4 object reassignment causing $effect infinite loop
The splitAmounts = { ...splitAmounts } pattern created a circular
dependency inside $effect blocks—reading and writing the same reactive
value—which Svelte 5 killed via loop protection, leaving the split
method selector non-reactive when selecting "50/50 + personal".
This commit is contained in:
@@ -58,7 +58,6 @@
|
|||||||
splitAmounts[user] = splitAmount;
|
splitAmounts[user] = splitAmount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
splitAmounts = { ...splitAmounts };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateFullPayment() {
|
function calculateFullPayment() {
|
||||||
@@ -75,7 +74,6 @@
|
|||||||
splitAmounts[user] = amountPerOtherUser;
|
splitAmounts[user] = amountPerOtherUser;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
splitAmounts = { ...splitAmounts };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculatePersonalEqualSplit() {
|
function calculatePersonalEqualSplit() {
|
||||||
@@ -100,7 +98,6 @@
|
|||||||
splitAmounts[user] = totalOwed;
|
splitAmounts[user] = totalOwed;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
splitAmounts = { ...splitAmounts };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSplitMethodChange() {
|
function handleSplitMethodChange() {
|
||||||
@@ -116,7 +113,6 @@
|
|||||||
splitAmounts[user] = 0;
|
splitAmounts[user] = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
splitAmounts = { ...splitAmounts };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user