Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(meter, progress-bar, progress-circle): use innerText when label is not provided #3483
fix(meter, progress-bar, progress-circle): use innerText when label is not provided #3483
Changes from 18 commits
5debd8e
62811f3
6eb2d50
1ebe0c3
6c93b20
d5dca86
ac2c34b
c427759
c016665
ad61446
a321600
1c05f55
16337a3
d3ddb18
08af668
2e17b8e
7932e0c
3bc3a04
01201f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 is the work that I was attempting to do in a lazy manner by removing the
ObserveSlotText
mixin from this class. Below ingetLabelFromSlot
you already do a check for this, so if you were to removeslotHasContent
from the method signature there you would be able to do less work in this element unless it was needed, as signified by the lack of alabel
.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.
so should I remove the slotHasContent all together from the method itself?
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.
If the functionality continues as expected without it, yes.
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.
So Im running into a small issue here... If I remove the slotHasContent Attribute then in the dev warnings the condition to give warning would be true if the label is not there. So let's say someone has provided some content in the slot but still that condition would be true for the first render call and then it would be false as the label would get updated from the slot content. But this also means the warning would still be there in console from the first call. That is why I added this variable to check if the slot has content then we don't show the warning even if the label is not there bcz we know eventually label would be updated with the slot content once the onSlotChange method is completed!
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.
Super helpful delineation!
ObserveSlotText
will always do some work, whether you have content or not, have a label or not, have Dev Mode or not...Any work within
if (window.__swc.DEBUG) { ... }
will only happen when Dev Mode is on. So if we replace!this.slotHasContent
in line 154 with!this.slotEl.assignedNodes().length
we'd only require using in that context to do that work.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.
Got it... I'll fix it and make a commit now... Thank you so much for clarifying