-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): support dom.maxStringLength configuration (#6175) #6311
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
feat(browser): support dom.maxStringLength configuration (#6175) #6311
Conversation
The CI build failed on I'd appreciate any guidance on how to proceed from here. |
Thanks for the work! I re-ran the failing tests, all good now. I'll merge this in, so it should go out with the next release 🚀 |
/** | ||
* Given a child DOM element, returns a query-selector statement describing that | ||
* and its ancestors | ||
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] | ||
* @returns generated DOM path | ||
*/ | ||
export function htmlTreeAsString(elem: unknown, keyAttrs?: string[]): string { | ||
export function htmlTreeAsString( |
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.
Hmm, actually, this is technically a breaking change (as this method is exported...), so we can't change the signature in that way 😬
Can you make this:
export function htmlTreeAsString(
elem: unknown,
keyAttrs?: string[],
options?: { maxStringLength?: number }
) {}
It's not as nice, but will have to do for now!
Or, alternatively, make it a union type:
export function htmlTreeAsString(
elem: unknown,
options?: { keyAttrs?: string[], maxStringLength?: number } | string[]
) {}
And handle this in the code?
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.
Agh thanks! I didn't think through how this function isn't merely exposed to other packages within this repo, but that it's also exposed anywhere that imports @sentry/utils
. I've updated to that latter format, and I've restored the test for the original format.
3c99a73
to
052be4b
Compare
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.
Thanks for the PR! This will go out with the next release 🎉
Implements the configuration feature described in #6175 . This lets sentry users opt in to having longer, potentially more helpful, UI breadcrumbs.
Closes #6175