-
Notifications
You must be signed in to change notification settings - Fork 124
v4.8.0 #4890
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
v4.8.0 #4890
Conversation
…f 500 will be reported.
…ab, but fail to retrieve asset data.
* Fixed: Fix issues in the edit form of the account list * Fixed: Switch Add Template And Edit --------- Co-authored-by: zhaojisen <1301338853@qq.com>
* pr@dev@perf_update_role_etail * perf: update clone error * perf: update query set * perf: update some clone --------- Co-authored-by: ibuler <ibuler@qq.com>
} | ||
} | ||
|
||
</style> |
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 code has not shown any inconsistencies nor bugs, but it does contain some stylistic improvements that might make it easier to read and maintain:
- Use
use strict
at the top beforewindow
, which will enforce stricter error checking. - Change import statements to use ES6 syntax for imports.
Let me know if you need these changes done for specific files instead of globally!
Here is an example on how to do this globally for all js files:
// Global variables
if (typeof window!=='undefined') {
// Strict mode
global.useStrict = true;
}
global.setDebugMode = function(mode){
if(typeof console === "object") {
console.debug = mode ? true: false;
}
}
} | ||
} | ||
} | ||
</style> |
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.
The code appears to be correctly formatted but does not include many of the standard checks that might be performed on an object. This could potentially lead to errors or unexpected behavior when working with objects. For instance, checking if the value of a property is truthy would be helpful:
if (
this.rows.length === 0 &&
!!this.selectedRows.length
)
A simpler approach to achieve identical results without needing any extra properties would simply have all values defined directly in the data rather than using computed properties.
This is because the computed properties are just functions that evaluate at runtime and may introduce side effects like variable shadowing which can lead to unpredictable changes outside the component. To fix it we should use plain JavaScript variables.
Here's how you could rewrite your computation
function:
computed: {
iRows() {
if (!this.rows?.length && !this.$isEmpty(this.selectedRows)) {
return [...this.selectedRows];
}
return [];
}
},
Remember to add the updated computation method in the "constructor", as per Vue's best practices.
And ensure no additional computed property or methods are added to the class beyond these two.
Also, remember that even though it seems straightforward now, future changes in your application architecture could make this approach less maintainable. It's important to consider scalability while writing such logic efficiently.
//} | ||
} | ||
} | ||
</style> |
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.
I don't have much difference to compare here because there aren't any complex elements like dynamic components that were created using Vue.js. The template uses Vue directives such as $el and V-for which is handled differently.
However:
- Use of
:v-if
instead of traditional JavaScript conditional operators can lead to confusion sometimes. - You might want to consider adding some validations in case if user inputs are null/undefined
- Consider making it consistent with other vue templates on how you're utilizing
vue-draggable
- Ensure compatibility across different versions of Vue
Keep these points in mind while reviewing. This is also an example based on what's available in the knowledge base for now, but I'm unable to access future developments beyond April 2023.
Let me know if anything specific about these points needs attention!
|
v4.8.0