Skip to content

feat: hide unchanged files when comparing metadata between orgs - #1991

Merged
paustint merged 1 commit into
mainfrom
feat/hide-unchanged-metadata-files
Aug 23, 2026
Merged

feat: hide unchanged files when comparing metadata between orgs#1991
paustint merged 1 commit into
mainfrom
feat/hide-unchanged-metadata-files

Conversation

@paustint

Copy link
Copy Markdown
Contributor

When comparing metadata across two orgs, the sidebar colors every file green or red, but a retrieve routinely returns hundreds or thousands of components and nearly all of them match. The handful of differences the user opened the modal to find are buried, and the tree had no filter of any kind.

Closes #1334

Copilot AI lite review requested due to automatic review settings August 22, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the “compare metadata between orgs” experience by adding an option to hide unchanged (matching) metadata files so users can focus on the small set of differences, addressing the usability problem described in #1334.

Changes:

  • Added a “Hide Unchanged Files” toggle in the metadata comparison sidebar, including a visible/total file count and an empty-state message when everything matches.
  • Introduced tree filtering/counting utilities to remove matching files while pruning empty folders.
  • Improved the shared Tree component so that when its items list changes and the selected node disappears (e.g. due to filtering), it selects and emits the first remaining leaf node; added tests and Vitest DOM setup for the deploy feature.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/ui/src/lib/tree/Tree.tsx Adds fallback selection behavior when the selected tree item is filtered out.
libs/ui/src/lib/tree/tests/Tree.spec.tsx Adds coverage for re-emitting selection and fallback selection behavior.
libs/features/deploy/vite.config.mts Adds shared DOM test setup to support new UI tests.
libs/features/deploy/src/view-or-compare-metadata/viewOrCompareMetadataUtils.tsx Adds filterUnchangedFiles and countMetadataFiles helpers for the sidebar filter.
libs/features/deploy/src/view-or-compare-metadata/ViewOrCompareMetadataSidebar.tsx Adds the “Hide Unchanged Files” toggle, file counts, and empty-state messaging; uses filtered tree items.
libs/features/deploy/src/view-or-compare-metadata/ViewOrCompareMetadataModal.tsx Adds label help text for “Hide Unchanged Regions”.
libs/features/deploy/src/view-or-compare-metadata/tests/viewOrCompareMetadataUtils.spec.ts Adds unit tests for filtering and counting utilities.
libs/features/deploy/src/view-or-compare-metadata/tests/ViewOrCompareMetadataSidebar.spec.tsx Adds sidebar behavior tests for filtering, counts, and selection behavior.
Suppressed comments (1)

libs/ui/src/lib/tree/Tree.tsx:88

  • Typo in inline comment: "e.x." should be "e.g." ("for example").
      // The selected item is no longer in the tree (e.x. it was filtered out), fall back to the first remaining leaf node.
      // Updating the selection re-runs this effect, which is what emits the new selection.
      const firstLeafNode = getFirstLeafNodeId(ids, idMap);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread libs/ui/src/lib/tree/Tree.tsx
@paustint
paustint force-pushed the feat/hide-unchanged-metadata-files branch 2 times, most recently from c98464d to 0aff1fa Compare August 23, 2026 01:40
@paustint

Copy link
Copy Markdown
Contributor Author

Code review summary

Automated review (Claude Code). Fixes below are pushed as an amend to the PR head.

Verdict: clean, well-scoped display-time filter with solid unit coverage. No outstanding decisions.

Verified correct: the filter is non-mutating and memoized, and the deploy/export/footer counts correctly continue to use the unfiltered set.

Fixed and pushed

  • viewOrCompareMetadataUtils.tsx — a real diff could be silently hidden. Two nullish contents compared as equal, so a file whose content could not be read from the retrieve zip on both sides was classified "unchanged" and vanished entirely once the filter was on. That is the dangerous direction for this feature: indistinguishable from "identical". Files are now retained when either side's content is nullish, since equality is unknown rather than proven. Test added for the both-nullish case.
  • useViewOrCompareMetadata.tsx — stale error hid the new toggle. The reducer never cleared targetError, so once a target fetch failed the error persisted and permanently hid the toggle even after a successful retry. FETCH now clears the error per-branch.

Before applying the second fix, confirmed it masks nothing: FETCH already resets loading/status/results for the org being fetched, FETCH_ERROR is the only writer of these fields, and nothing reads the error after a new fetch begins. Clearing is per-branch because handleReload re-fetches both orgs and targetError cannot be set before a target org is chosen.

(features-deploy 18/18, Tree.spec.tsx 16/16, typecheck clean.)

Note: the fix lives in the hook, not ViewOrCompareMetadataSidebar.tsx — the sidebar only consumes props.

When comparing metadata across two orgs, the sidebar colors every file
green or red, but a retrieve routinely returns hundreds or thousands of
components and nearly all of them match. The handful of differences the
user opened the modal to find are buried, and the tree had no filter of
any kind.

Closes #1334
@paustint
paustint force-pushed the feat/hide-unchanged-metadata-files branch from 0aff1fa to e0e98c5 Compare August 23, 2026 13:14
@paustint
paustint merged commit e035f76 into main Aug 23, 2026
14 checks passed
@paustint
paustint deleted the feat/hide-unchanged-metadata-files branch August 23, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide Unchanged Metadata Files from List

2 participants