mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
Fix: Update button remaining disabled in transaction edit mode
This commit resolves an issue where the Update button in the transaction form would remain disabled when attempting to edit a transaction. The problem was in how the transactionStore was managing state updates during transaction editing. Key changes: - Enhanced startEditingTransaction function in transactionStore.ts to ensure proper reactivity - Added clean copy creation of transaction objects to avoid reference issues - Implemented a state update cycle with null value first to force reactivity - Added a small timeout to ensure state changes are properly detected by components The Transaction form now correctly enables the Update button when in edit mode, regardless of account selection state.
This commit is contained in:
61
prisma/migrations/20250505192354_initial/migration.sql
Normal file
61
prisma/migrations/20250505192354_initial/migration.sql
Normal file
@@ -0,0 +1,61 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "AccountType" AS ENUM ('CHECKING', 'SAVINGS', 'CREDIT_CARD', 'INVESTMENT', 'OTHER');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "AccountStatus" AS ENUM ('ACTIVE', 'CLOSED');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "TransactionStatus" AS ENUM ('PENDING', 'CLEARED');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "TransactionType" AS ENUM ('DEPOSIT', 'WITHDRAWAL', 'TRANSFER', 'UNSPECIFIED');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "accounts" (
|
||||
"id" TEXT NOT NULL,
|
||||
"bankName" TEXT NOT NULL,
|
||||
"accountNumber" VARCHAR(6) NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"type" "AccountType" NOT NULL DEFAULT 'CHECKING',
|
||||
"status" "AccountStatus" NOT NULL DEFAULT 'ACTIVE',
|
||||
"currency" TEXT NOT NULL DEFAULT 'USD',
|
||||
"balance" DECIMAL(10,2) NOT NULL DEFAULT 0,
|
||||
"notes" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "accounts_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "transactions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"accountId" TEXT NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL,
|
||||
"description" TEXT NOT NULL,
|
||||
"amount" DECIMAL(10,2) NOT NULL,
|
||||
"category" TEXT,
|
||||
"status" "TransactionStatus" NOT NULL DEFAULT 'CLEARED',
|
||||
"type" "TransactionType" NOT NULL DEFAULT 'UNSPECIFIED',
|
||||
"notes" TEXT,
|
||||
"tags" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "transactions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "accounts_status_idx" ON "accounts"("status");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "transactions_accountId_idx" ON "transactions"("accountId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "transactions_date_idx" ON "transactions"("date");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "transactions_category_idx" ON "transactions"("category");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "transactions" ADD CONSTRAINT "transactions_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "accounts"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "postgresql"
|
||||
Reference in New Issue
Block a user