# Fix: Transaction Type Reference Error in Edit Mode #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #32
Issue
Fixed issue #32 where editing a transaction would throw a
ReferenceError: currentTransactionType is not definederror. This occurred when trying to edit a transaction after previously editing another transaction.Changes Made
currentTransactionTypeis properly initialized before any function usageTechnical Details
The issue was caused by the
currentTransactionTypevariable being declared in the middle of the file, which could lead to reference errors if the code execution path didn't reach that declaration before using the variable. By moving it to the top of the file with other global variables, we ensure it's always properly initialized before use.Testing
The fix has been tested by:
Impact
This change improves the reliability of the transaction editing functionality and prevents potential type switching issues when editing different types of transactions in sequence.