-
Notifications
You must be signed in to change notification settings - Fork 34
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
fix: capture customLabelProp if set #302
Conversation
Size Change: +84 B (+0.08%) Total Size: 106 kB
ℹ️ View Unchanged
|
@@ -91,7 +93,7 @@ export const PostHogProvider = ({ | |||
|
|||
return ( | |||
<View | |||
ph-label="PostHogProvider" | |||
{...{ [phLabelProp]: 'PostHogProvider' }} // Dynamically setting customLabelProp (default: ph-label) |
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.
that is chatgpt code :D
const elAttrLabelKey = `attr__${customLabelProp}` | ||
let lastLabel: string | undefined = undefined | ||
|
||
for (let i = elements.length - 1; i >= 0; i--) { | ||
const element = elements[i] | ||
if (element[elAttrLabelKey]) { | ||
// this element had a ph-label set, promote it to the lastLabel | ||
// this element had a customLabelProp (default: ph-label) set, promote it to the lastLabel |
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.
Can't we just iterate over normally here with early exit instead of reverse?
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.
the reason why it is reversed is in the comment above.
I'd not change what's working already as well, the change is about using the wrong label name only.
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.
looks good :)
Problem
Closes #301
Changes
Release info Sub-libraries affected
Bump level
Libraries affected
Changelog notes