fix: Application List - Hold down Ctrl+to set the new window opened to still be the application list page#4451
Conversation
…o still be the application list page
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| window.open(newUrl) | ||
| } else { | ||
| router.push({ path: `/application/workspace/${row.id}/workflow` }) | ||
| } |
There was a problem hiding this comment.
The given code seems to be properly structured and free from syntax errors. However, there are few optimizations that can be considered:
-
Functionality Simplification: Since
rowis passed as an argument to the function, you don't need to check ifevent.ctrlKeyexists before accessing it. This can reduce verbosity:const { ctrlKey } = event || {};
-
Avoiding Duplicated Code: The
window.opencalls in both branches of the conditional statement could share some logic. You might want to refactor them into separate utility functions or a helper method. -
Use of Router Functions Directly: Instead of calling
router.resolve, you could directly callrouter.replaceorreplaceSyncdepending on whether it needs to trigger a history navigation or not. For opening a new tab without navigating through history:window.open(router.resolve({ path: `/application/workspace/${row.id}/workflow` }).href, '_blank');
-
Type Checking/Validation: Ensure that
eventandrow.idhave been defined when this function is called. Proper type checking and validation would prevent runtime errors if either parameter were missing.
Overall, the provided code performs well and should work as expected, but these refinements can make it more robust and concise. Make those changes based on your application's requirements.
fix: Application List - Hold down Ctrl+to set the new window opened to still be the application list page