mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-01-15 05:33:26 +01:00
Inefficient Transaction Update Operation #80
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SerafimPikalov on GitHub (Dec 7, 2025).
The
perform_updatemethod inTransactionViewSetaccessesserializer.data["pk"]which triggers unnecessary full serialization of the transaction object, then fetches the same object from the database again. This is inefficient and can cause issues in edge cases.Steps to Reproduce:
/api/transactions/{id}/Expected Behavior:
The update operation should use the instance directly from the serializer without triggering serialization or additional database queries.
Actual Behavior:
The code:
serializer.data["pk"]Transaction.objects.get(pk=...)@eitchtee commented on GitHub (Dec 7, 2025):
Dang, nice catch.
I will update the function to use
self.get_object()which should be more efficient. Thank you!