Should: Automatic Cache Clearing for Version Control Operations

Problem Statement

Currently, when switching branches in Git or reverting to previous versions in Lovable, the TypeScript and build caches are not automatically cleared. This leads to:

  • Stale type definitions causing false TypeScript errors

  • Build artifacts from different versions conflicting

  • Developer time wasted manually clearing caches

  • Confusing error messages that don't match the current codebase

Examples of Issues

  1. TypeScript errors about missing properties (e.g., 'is_overflow') that should exist

  2. Build cache conflicts between different versions of the same component

  3. Persistent type errors even after reverting to known-working versions

Proposed Solution

Implement automatic cache clearing triggers for:

  1. Git branch switching operations

  2. Version revert operations in Lovable

  3. Code restoration from previous edits

Technical Implementation Details

The system should:

  1. Clear the TypeScript compilation cache

  2. Remove build artifacts

  3. Clear Vite's build cache

  4. Regenerate type definitions

  5. Trigger a fresh build

Key Folders/Files to Clear

  • .tsbuildinfo files

  • node_modules/.vite

  • node_modules/.cache

  • Temporary build directories

Success Criteria

  • No TypeScript errors when switching branches

  • Clean builds after version changes

  • Automatic type regeneration

  • No manual cache clearing needed

Additional Benefits

  1. Improved developer experience

  2. Reduced debugging time

  3. More reliable builds

  4. Consistent type checking

Priority

Blocking - This is blocking my development

Related Issues

  • TypeScript errors when switching branches

  • Build inconsistencies after version changes

  • Manual cache clearing requirements

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
πŸ›

Bug Hunting

Date

28 days ago

Author

AndrΓ© Brunetta

Subscribe to post

Get notified by email when there are changes.