Skip to content

fix(ui): pass createdBy to highlight query column #14042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 21, 2025

Conversation

yoonhyejin
Copy link
Collaborator

Copy link

alwaysmeticulous bot commented Jul 11, 2025

✅ Meticulous spotted 0 visual differences across 1589 screens tested: view results.

Meticulous evaluated ~8 hours of user flows against your PR.

Expected differences? Click here. Last updated for commit d84591e. This comment will update as new commits are pushed.

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Jul 11, 2025
@datahub-cyborg datahub-cyborg bot added the needs-review Label for PRs that need review from a maintainer. label Jul 11, 2025
Copy link

codecov bot commented Jul 11, 2025

Bundle Report

Changes will increase total bundle size by 323 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
datahub-react-web-esm 22.18MB 323 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: datahub-react-web-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-*.js 323 bytes 18.54MB 0.0%

Files in assets/index-*.js:

  • ./src/app/entityV2/shared/tabs/Dataset/Queries/useQueryTableColumns.tsx → Total Size: 4.64kB

  • ./src/app/entityV2/shared/tabs/Dataset/Queries/types.ts → Total Size: 412 bytes

  • ./src/app/entityV2/shared/tabs/Dataset/Queries/utils/mapQuery.ts → Total Size: 733 bytes

  • ./src/app/entityV2/shared/tabs/Dataset/Queries/queryColumns.tsx → Total Size: 4.43kB

Copy link

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ityV2/shared/tabs/Dataset/Queries/queryColumns.tsx 20.00% 4 Missing ⚠️
...ared/tabs/Dataset/Queries/useQueryTableColumns.tsx 0.00% 1 Missing ⚠️
...tyV2/shared/tabs/Dataset/Queries/utils/mapQuery.ts 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (53.84%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@chriscollins3456 chriscollins3456 left a comment

Choose a reason for hiding this comment

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

one suggestion on how we can avoid type casting and risking white screens of death! this is a tactic i'm going to push for going forward

@@ -17,6 +17,7 @@ export function mapQuery({ queryEntity, entityUrn, siblingUrn, poweredEntity }:
description: queryEntity.properties?.description || undefined,
query: queryEntity.properties?.statement?.value || '',
createdTime: queryEntity?.properties?.created?.time,
createdBy: queryEntity?.properties?.createdOn?.actor as CorpUser,
Copy link
Collaborator

Choose a reason for hiding this comment

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

so we're trying to avoid casting types as much as possible going forward because that's what gets us into situations where we get white screens of death.

What i think we can do here that is much safer is instead of having createdBy being a CorpUser is map createdBy into the correct type for what we're fetching for exactly. here's what i mean:

inside of the actor field in query.graphql we can request for a new fragment called ActorWithDisplayName that's simply:

                urn
                type
                ...entityDisplayNameFields

and since that's what we request for, we can set createdBy?: ActorWithDisplayNameFragment (this type gets autogenerated like other types) in ...Queries/types.ts so then we don't actually have to do any type casting and it is typed accurately to what is being fetched.

i find creating fragments with helpful names we can use as types in the app to be much nicer and obviously safer than type casting.

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Jul 15, 2025
@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Jul 16, 2025
Comment on lines 79 to 84
const photoUrl =
createdBy?.__typename === 'CorpUser'
? (createdBy as any)?.editableProperties?.pictureLink ||
(createdBy as any)?.editableInfo?.pictureLink ||
undefined
: undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we querying for these fields in entityDisplayNameFields? otherwise I don't think we'll ever render them hence you having to cast as any here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chriscollins3456 nice catch - would something like this work? i don't want to use corpUser if possible, wondering if there's a better approach

adding fields in query.graphql

fragment ActorWithDisplayName on Entity {
    urn
    type
    ...entityDisplayNameFields
    ... on CorpUser {
        editableProperties {
            pictureLink
        }
        editableInfo {
            pictureLink
        }
    }
}

and updating queryColumns.tsx

    const photoUrl =
        createdBy.__typename === 'CorpUser'
            ? createdBy?.editableProperties?.pictureLink || createdBy?.editableInfo?.pictureLink || undefined
            : undefined;

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah i think that would work! however we could make it even cleaner since we know actor is a CorpUser in ResolvedAuditStamp - we could do fragment ActorWithDisplayName on CorpUser here and then when we use ActorWithDisplayNameFragment in the UI i don't think we'll have to have that __typename check because it should be properly typed and less ambiguous. let me know if that works!

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Jul 16, 2025
@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Jul 17, 2025
Copy link
Collaborator

@chriscollins3456 chriscollins3456 left a comment

Choose a reason for hiding this comment

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

nice!

@datahub-cyborg datahub-cyborg bot added pending-submitter-merge and removed needs-review Label for PRs that need review from a maintainer. labels Jul 18, 2025
@yoonhyejin yoonhyejin merged commit 14b9bed into master Jul 21, 2025
61 of 63 checks passed
@yoonhyejin yoonhyejin deleted the ui/highlight-query-owner branch July 21, 2025 15:22
kartikey-visa pushed a commit to kartikey-visa/datahub that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-submitter-merge product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants