-
Notifications
You must be signed in to change notification settings - Fork 171
chore: Provide additinal component metadata #3483
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
Conversation
useTelemetry('AnnotationContext'); | ||
useBaseComponent('AnnotationContext'); |
There was a problem hiding this comment.
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
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 }, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 package
export interface AnalyticsMetadata {
instanceIdentifier?: string;
flowType?: FlowType;
errorContext?: string;
resourceType?: string;
}
// toolkit
export type AnalyticsMetadata = 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
1bdb35f
to
d7b29a7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
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
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.