Skip to content

chore: Provide additinal component metadata - #3483

Merged
just-boris merged 1 commit into
mainfrom
base-component-metadata
May 12, 2025
Merged

chore: Provide additinal component metadata#3483
just-boris merged 1 commit into
mainfrom
base-component-metadata

Conversation

@just-boris

Copy link
Copy Markdown
Member

Description

Consume changes added in this PR: cloudscape-design/component-toolkit#132

Related links, issue #, if available: n/a

How has this been tested?

PR build

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

i18nStrings,
}: AnnotationContextProps): JSX.Element {
useTelemetry('AnnotationContext');
useBaseComponent('AnnotationContext');

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Switched all non-UI components to useBaseComponent for consistency.

The only difference, there is __internalRootRef which is left unused in these components, but the ref handling code checks its presence anyway, so this ref is effectively a no-op

Comment on lines +33 to +37
useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
useFocusVisible();
const elementRef = useComponentMetadata<T>(componentName, PACKAGE_VERSION, { ...analyticsMetadata });
const elementRef = useComponentMetadata<T>(
componentName,
{ packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There is an annoying structure difference between useComponentMetrics and useComponentMetadata. They receive same data, but in different shape. Still some refactoring needed.

const elementRef = useComponentMetadata<T>(
componentName,
{ packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },
analyticsMetadata as any

@just-borisjust-borisMay 7, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This value is typed differently in the toolkit and this package

// this packageexportinterfaceAnalyticsMetadata{instanceIdentifier?: string;flowType?: FlowType;errorContext?: string;resourceType?: string;}// toolkitexporttypeAnalyticsMetadata=JSONObject;

This component's more strict type is not assignable to the toolkit. Before my change we used to fool typescript with runtime code { ...analyticsMetadata }. I do not like it. If we mess with types anyway, let's do it more clearly at least

@codecov

codecovBot commented May 7, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.49%. Comparing base (5024307) to head (d7b29a7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #3483 +/- ##
==========================================
- Coverage 96.49% 96.49% -0.01% 
==========================================
Files 804 803 -1 Lines 23090 23088 -2 Branches 7587 8001 +414 ==========================================
- Hits 22281 22279 -2 + Misses 802 755 -47 - Partials 7 54 +47 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@just-boris
just-boris marked this pull request as ready for review May 7, 2025 18:37
@just-boris
just-boris requested a review from a team as a code ownerMay 7, 2025 18:38
@just-boris
just-boris requested review from a team, YueyingLu, cansuaa and gethinwebster and removed request for a team, YueyingLu and gethinwebsterMay 7, 2025 18:38
@just-boris
just-boris added this pull request to the merge queueMay 12, 2025
Merged via the queue into main with commit 39fe90fMay 12, 2025
@just-boris
just-boris deleted the base-component-metadata branch May 12, 2025 11:47
Sign up for freeto 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.

2 participants

@just-boris@cansuaa