You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor video history storage with namespaced keys and backward compatibility
This change improves LocalStorage organization by using namespaced keys for video details while maintaining full backward compatibility for existing clients.
## Changes:
- Video details now stored as `view_history/<uuid>` instead of plain `<uuid>`
- Maintains existing `view_history` array structure (stores UUIDs only)
- Implements lazy migration strategy with automatic fallback to old format
- All CRUD operations support both old and new storage formats
- Added comprehensive cleanup for both formats during deletions
## Backward Compatibility:
- Existing clients: Continue working seamlessly with gradual migration
- New clients: Use improved storage format from start
- No data loss: All existing view history preserved during transition
- Migration happens transparently during normal app usage
## Technical Details:
- Added fallback logic in queryFn to read from old format when new format unavailable
- updateHistory checks old format if new format entry not found, then migrates
- clearHistory and clearInstanceHistory clean up both storage formats
- deleteVideoFromHistory removes entries from both formats
- All migration code marked with TODO comments for easy removal in July 2025
## Benefits:
- Better LocalStorage organization with namespaced video data
- Reduced storage key collisions
- Easier debugging with structured key names
- Gradual, seamless migration without user impact
0 commit comments