-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Improve <SvgIcon>
to make it output svg
node and optimize performance
#23570
Conversation
267a6a3
to
6d93d55
Compare
<SvgIcon>
to make it output single node and optimize performance<SvgIcon>
to make it output svg
node and optimize performance
This does seem like a lot of extra code and it redoes most of what |
Nope, not extra. Just some comment, and necessary code to handle attributes / "class"+"class-name" correctly.
They do not do the same thing. The key point is, in your old
No, nothing is lost. Before, for the Now, we parse the svgOuterHtml, and leave the svgInnerHtml to browser. Nothing is parsed twice. |
Actually, the old SvgIcon is slower, because it does create extra node or parse twice. Old code for default arguments:
Old code for non-default arguments:
After this PR:
|
f13f690
to
367ffca
Compare
9194d39
to
a44e451
Compare
Co-authored-by: silverwind <me@silverwind.io>
3ede48b
to
5677a81
Compare
59f03a2
to
0b00826
Compare
0b00826
to
e8e2c5e
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #23570 +/- ##
==========================================
- Coverage 47.14% 47.12% -0.02%
==========================================
Files 1149 1154 +5
Lines 151446 152353 +907
==========================================
+ Hits 71397 71798 +401
- Misses 71611 72075 +464
- Partials 8438 8480 +42
... and 34 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
* upstream/main: Fix incorrect `HookEventType` of pull request review comments (go-gitea#23650) [skip ci] Updated translations via Crowdin Fix codeblocks in the cheat sheet (go-gitea#23664) Drop migration for ForeignReference (go-gitea#23605) Fix new issue/pull request btn margin when it is next to sort (go-gitea#23647) A tool to help to backport locales, changes source strings to fix other broken translations (go-gitea#23633) Fix incorrect `show-modal` and `show-panel` class (go-gitea#23660) Restructure documentation. Now the documentation has installation, administration, usage, development, contributing the 5 main parts (go-gitea#23629) Check LFS/Packages settings in dump and doctor command (go-gitea#23631) Use a general approach to show tooltip, fix temporary tooltip bug (go-gitea#23574) Improve workflow event triggers (go-gitea#23613) Improve `<SvgIcon>` to make it output `svg` node and optimize performance (go-gitea#23570)
Before, the Vue
<SvgIcon>
always outputs DOM nodes like:The
span
is redundant and I guess such layout and the inconsistentclass/class-name
attributes would cause bugs sooner or later.This PR makes the
<SvgIcon>
clear, and it's faster than before, because it doesn't need to parse the whole SVG string.Before:
After: