Skip to content

Commit

Permalink
Only consider repos defining the asset with a corresponding op for mu…
Browse files Browse the repository at this point in the history
…ltiple repo notice (#7186)
  • Loading branch information
bengotow committed Mar 31, 2022
1 parent 81360ce commit 6550409
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export const AssetDefinedInMultipleReposNotice: React.FC<{
const otherRepos =
data?.repositoriesOrError.__typename === 'RepositoryConnection'
? data.repositoriesOrError.nodes.filter(
(n) =>
(n.name !== loadedFromRepo.name || n.location.name !== loadedFromRepo.location) &&
n.assetNodes.some((n) => n.id === assetId),
(r) => r.name !== loadedFromRepo.name || r.location.name !== loadedFromRepo.location,
)
: [];

if (otherRepos.length === 0) {
const otherReposWithAsset = otherRepos.filter((r) =>
r.assetNodes.some((a) => a.id === assetId && a.opName),
);

if (otherReposWithAsset.length === 0) {
return <span />;
}

Expand All @@ -35,7 +37,7 @@ export const AssetDefinedInMultipleReposNotice: React.FC<{
title={`Multiple repositories in your workspace include assets with this name. Showing the definition from ${buildRepoPath(
loadedFromRepo.name,
loadedFromRepo.location,
)} below. (Also found in ${otherRepos
)} below. (Also found in ${otherReposWithAsset
.map((o) => buildRepoPath(o.name, o.location.name))
.join(', ')}). You may want to consider renaming to avoid collisions.`}
/>
Expand All @@ -57,6 +59,7 @@ const ASSET_ID_SCAN_QUERY = gql`
}
assetNodes {
id
opName
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6550409

Please sign in to comment.