-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
refactor(ui): optimize Link functionality #11743
refactor(ui): optimize Link functionality #11743
Conversation
- move static functions outside of the component - this way they are not created every time the component is and hence use less memory etc - use named `function`s instead of `const`s assigned to anonymous functions - this makes tracing a bit easier and source maps a bit clearer - (also technically a memory improvement as well) - re-use `openLinkWithKey` in `WorkflowDetails` instead of having duplicate code - rename to `openLinkWithKey` so that it doesn't overlap with `openLink` and to be a bit more specific - (also a very tiny memory improvement) - remove redundant `formatURL` function - use lowercase "p" in `processURL` - JS convention that only classes are capitalized (or components in React, which used to always be classes) - I imagine this might have been capitalized b/c Go uses capitals for exports? - be more specific with `urlExpression` as the argument since it is not necessarily a raw URL and that is why it needs "processing" Signed-off-by: Anton Gilgur <[email protected]>
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.
Could totally be my lack of frontend knowledge, but I didn't quite understand the function name for openLinkWithKey
here, I assumed this was more my fault and approved.
I wrote this a few weeks ago, but it's quite literal, since it's when clicked with |
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 doesn't seem to fix #11741?
Correct. I didn't say it did. Per the opening comment, this was an incidental finding while I was investigating that |
Signed-off-by: Anton Gilgur <[email protected]>
Head branch was pushed to by a user without write access
Motivation
links
module and its usage a bitStumbled upon this while investigating #11741 and thought it could use some improvements
Modifications
move static functions outside of the component
use named
function
s instead ofconst
s assigned to anonymous functionsboth of these also reduce nesting
re-use
openLinkWithKey
inWorkflowDetails
instead of having duplicate codeopenLinkWithKey
so that it doesn't overlap withopenLink
and to be a bit more specificremove redundant
formatURL
functionuse lowercase "p" in
processURL
be more specific with
urlExpression
as the argument since it is not necessarily a raw URL and that is why it needs "processing"Verification
Stylistic and performance changes, but no usage changes (minor semantic differences that improve tracing, memory, etc as mentioned above, but do not change usage).