diff options
| author | naoNao89 <90588855+naoNao89@users.noreply.github.com> | 2025-07-31 05:29:42 +0700 |
|---|---|---|
| committer | naoNao89 <90588855+naoNao89@users.noreply.github.com> | 2025-07-31 05:29:42 +0700 |
| commit | a1d2fbd96bb6713c3172198d71e94274af409aee (patch) | |
| tree | b8bf5c16f221462272512377331204b6290607a9 /apps/web/package.json | |
| parent | e6e08057f510e70c956af0f0c08c6eef349edf3c (diff) | |
| download | opencut-a1d2fbd96bb6713c3172198d71e94274af409aee.tar.gz | |
[Editor] Prevent excessive project creation from invalid routes
Race conditions in useEffect hook caused navigation to invalid project IDs
to create multiple 'Untitled Project' entries. Users reported accumulating
885+ projects due to this bug.
This change adds global invalid project ID tracking across component remounts
and prevents race conditions through:
- Global invalidProjectIds Set in project store with tracking functions
- isInitializingRef to prevent duplicate initialization attempts
- Proper useEffect cleanup with cancellation tokens
- Specific error handling for 'not found' vs recoverable errors
- Removed problematic activeProject?.id dependency
Testing:
- Add comprehensive test suite (15 tests) with Vitest + React Testing Library
- Include integration tests demonstrating bug and validating fix
- Update CI pipeline to run automated tests
Fixes #182
Diffstat (limited to 'apps/web/package.json')
| -rw-r--r-- | apps/web/package.json | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/web/package.json b/apps/web/package.json index 9531b6c7..2fc6f1ad 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -10,6 +10,11 @@ "lint": "biome check src/", "lint:fix": "biome check src/ --write", "format": "biome format src/ --write", + "test": "vitest", + "test:run": "vitest run", + "test:ui": "vitest --ui", + "test:coverage": "vitest run --coverage", + "test:excessive-projects": "vitest run --reporter=verbose src/__tests__/excessive-projects.test.ts", "db:generate": "drizzle-kit generate", "db:migrate": "drizzle-kit migrate", "db:push:local": "cross-env NODE_ENV=development drizzle-kit push", @@ -71,15 +76,24 @@ }, "devDependencies": { "@tailwindcss/typography": "^0.5.16", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/user-event": "^14.5.2", "@types/bun": "latest", + "@types/node": "^24.1.0", "@types/pg": "^8.15.4", "@types/react": "^18.2.48", "@types/react-dom": "^18.2.18", + "@vitejs/plugin-react": "^4.7.0", + "@vitest/coverage-v8": "^3.2.4", + "@vitest/ui": "^3.2.4", "cross-env": "^7.0.3", "drizzle-kit": "^0.31.4", + "jsdom": "^26.0.0", "postcss": "^8", "tailwindcss": "^3.4.1", "tsx": "^4.7.1", - "typescript": "^5.8.3" + "typescript": "^5.8.3", + "vitest": "^3.2.4" } } |
