When the "Modified" filter was active, some files marked as "unchanged" were still appearing in the file list with chevrons, even though they had no modified functions to display.
tx_isp_missing_funcs.c- marked "unchanged", showing with chevrongc2053.c- marked "unchanged", showing with chevron
These files would expand to show "No function matches found for current filter" message, which is confusing and clutters the UI.
The code was pre-populating filteredGroups with ALL files from fileChanges, regardless of whether they had any function pairs matching the current filter:
// OLD CODE - WRONG
fileChanges.forEach(fileChange => {
const fileKey = filePath.split('/').pop() || filePath;
// This added EVERY file to filteredGroups, even if it has no matching functions
if (!filteredGroups.has(fileKey)) {
filteredGroups.set(fileKey, []); // Empty array for all files
}
statusMap.set(fileKey, {...});
});
// Then later, function pairs were added
filtered.forEach(pair => {
filteredGroups.get(fileKey)!.push(pair);
});This meant:
- All files got added to
filteredGroupswith empty arrays - Only files with matching functions got pairs added
- Files with no matching functions remained in
filteredGroupswith empty arrays - The empty filtering at the end tried to remove them, but there was a logic issue
Changed the logic to only add files to filteredGroups if they actually have function pairs after filtering:
// NEW CODE - CORRECT
// Build statusMap for all files (for reference/metadata)
fileChanges.forEach(fileChange => {
const fileKey = filePath.split('/').pop() || filePath;
statusMap.set(fileKey, {
...fileChange,
functionCount: actualCount
});
});
// Only add files to filteredGroups if they have function pairs
filtered.forEach(pair => {
const fileKey = fileName.split('/').pop() || fileName;
// This creates the entry ONLY when there's a pair to add
if (!filteredGroups.has(fileKey)) {
filteredGroups.set(fileKey, []);
}
filteredGroups.get(fileKey)!.push(pair);
});File: nextjs-frontend/src/components/diff/BeyondCompareFunctionDiff.tsx
-
Removed pre-population of filteredGroups (lines 573-579 in old code)
- No longer adds all files upfront
- Files are only added when they have function pairs
-
Kept statusMap population (lines 571-583 in new code)
- Still builds metadata for all files
- Used for displaying file badges and counts
- But doesn't affect which files are shown
-
Removed redundant empty filtering (lines 619-625 in old code)
- No longer needed since we only add files with pairs
- Simplified the code
- ❌ Files with no matching functions appeared in the list
- ❌ Clicking chevron showed "No function matches found" message
- ❌ Cluttered UI with irrelevant files
- ✅ Only files with matching functions appear in the list
- ✅ Every file shown has at least one function to display
- ✅ Clean, focused UI
To verify the fix:
-
Set filter to "Modified"
- Should only show files that have modified functions
- Files with only unchanged functions should not appear
-
Set filter to "All"
- Should show all files with any functions
- Files with no functions at all should still not appear
-
Set filter to "Unchanged"
- Should only show files with unchanged functions
- Files with only modified functions should not appear
-
Expand any file
- Should always show function list (never "No function matches found")
- Every visible file has content to display
-
File marked "unchanged" but has modified functions
- File status badge shows "unchanged" (file-level metadata)
- File appears in list when "Modified" filter is active
- Shows the modified functions inside
-
File marked "modified" but all functions are unchanged
- File does NOT appear when "Modified" filter is active
- File appears when "Unchanged" or "All" filter is active
-
File with no functions at all
- Never appears in any filter view
- Doesn't clutter the UI
- ✅ Cleaner UI - No empty files shown
- ✅ Less confusion - Every file has content when expanded
- ✅ Better performance - Fewer DOM elements to render
- ✅ Simpler code - Removed redundant empty filtering logic
nextjs-frontend/src/components/diff/BeyondCompareFunctionDiff.tsx- Main fixUI_CLEANUP_AND_DEFAULTS.md- Overall UI improvements documentationSESSION_SUMMARY_FINAL.md- Complete session summary