Removed old AST diff components and updated default filtering/sorting to improve user experience.
Deleted Files:
nextjs-frontend/src/components/diff/ModernASTDiffViewer.tsx- Old broken AST diff viewernextjs-frontend/src/components/diff/InteractiveDiffViewer.tsx- Unused interactive diff viewer
Rationale:
- The ModernASTDiffViewer was using the old broken AST diff algorithm
- Now that AST diff is fixed and integrated into the main diff viewer, these separate components are redundant
- Simplifies the codebase and reduces confusion
File: nextjs-frontend/src/components/diff/BeyondCompareFunctionDiff.tsx
- Import of
ModernASTDiffViewer - Import of
Zapicon (was only used for AST Diff button) showModernDiffstate variablehandleModernDiffClickfunction- "AST Diff" buttons (2 instances)
- ModernASTDiffViewer modal at the end of the component
-
Default filter: Changed from
'all'to'modified'// Before: const [filterType, setFilterType] = useState<string>('all'); // After: const [filterType, setFilterType] = useState<string>('modified');
-
Button labels: Changed "AST Diff" buttons to "View Diff"
- More intuitive - users just want to see the diff, not worry about the algorithm
- Consistent with the single unified diff viewer approach
-
Sorting by similarity: Functions are now sorted by most different first
// Sort filtered pairs by similarity (most different first) filtered.sort((a, b) => { const simA = a.similarity ?? 1.0; const simB = b.similarity ?? 1.0; return simA - simB; // Lower similarity first (most different) }); // Sort function pairs within each file group by similarity filteredGroups.forEach(pairs => { pairs.sort((a, b) => { const simA = a.similarity ?? 1.0; const simB = b.similarity ?? 1.0; return simA - simB; // Lower similarity first (most different) }); });
-
Empty file filtering: Files with no functions matching the current filter are hidden
// Remove empty file groups (files with no functions matching the filter) const nonEmptyGroups = new Map<string, FunctionPair[]>(); filteredGroups.forEach((pairs, fileKey) => { if (pairs.length > 0) { nonEmptyGroups.set(fileKey, pairs); } });
- When viewing "Modified" functions, files with only unchanged functions are hidden
- Reduces clutter and focuses attention on relevant files
- Files reappear when filter is changed to "All" or other types
File: nextjs-frontend/src/app/page.tsx
Removed:
- Import of
InteractiveDiffViewer(no longer exists)
- Overwhelming: All functions shown by default (including unchanged)
- Cluttered: All files shown even if they have no matching functions
- Confusing: Two diff buttons ("Details" and "AST Diff")
- Poor prioritization: Functions shown in arbitrary order
- Redundant components: Multiple diff viewers doing similar things
- Focused: Only modified functions shown by default
- Clean: Only files with matching functions are displayed
- Simple: Single "View Diff" button
- Smart prioritization: Most different functions shown first
- Streamlined: One unified diff viewer with algorithm toggle
When users open the comparison view:
-
Filter: Only "Modified" functions are shown
- Users can still click "All" to see everything
- Other filters: Added, Deleted, Moved, Renamed, Unchanged
-
Sort: Functions sorted by lowest similarity first
- Most different (and likely most important) changes appear at the top
- Within each file, functions also sorted by difference
-
Diff Viewer: Single unified viewer with:
- LCS algorithm by default (fast, reliable)
- AST algorithm toggle available (adds semantic context)
- Ignore Whitespace option
- Unified and Side-by-Side view modes
- ✅ Less overwhelming - Focus on what changed
- ✅ Better prioritization - See biggest changes first
- ✅ Simpler interface - One button, clear purpose
- ✅ Faster workflow - Default settings match common use case
- ✅ Less code - Removed ~500 lines of redundant components
- ✅ Easier maintenance - Single diff viewer to maintain
- ✅ Clearer architecture - One way to view diffs
- ✅ Better tested - Focus testing on one component
No breaking changes - All functionality is preserved:
- AST diff is still available (via algorithm toggle in the unified viewer)
- All view modes still work (unified, side-by-side)
- All filters still available (just different default)
- Sorting can be changed if needed (future enhancement)
Potential improvements based on this foundation:
- User preferences - Remember filter/sort settings in localStorage
- Sort options - Add UI to toggle between different sort orders
- Smart defaults - Auto-expand files with most changes
- Keyboard shortcuts - Navigate between functions quickly
- Diff presets - Save common filter/sort combinations
To verify the changes:
- Start comparison - Should show only modified functions by default
- Check order - Most different functions should appear first
- Click "View Diff" - Should open the unified diff viewer
- Toggle filters - All filter options should still work
- No errors - Console should be clean (no missing component errors)
These changes make the UI more focused and user-friendly while simplifying the codebase. The default settings now match the most common use case: reviewing what changed, starting with the biggest differences.