-
Notifications
You must be signed in to change notification settings - Fork 8
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 loading in contracts table #2801
Conversation
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 liked ur function a lot. Great Job
@@ -218,6 +218,18 @@ const nodeIDs = computed(() => { | |||
return [...new Set(allContracts.value.map(contract => contract.details.nodeId) || [])]; | |||
}); | |||
|
|||
function updateLoadingTableValue(updateAllTables: boolean, loading = true, contractType?: ContractType) { | |||
if (updateAllTables) { |
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.
you could do a switch on contractType if your actions are going to be different, and also you don't need elseifs in your code given you do a return already in updateAllTables so you can safely start a new if or a switch
if updateAllTables {
....
return
}
switch contractType {
case contractType.Name:
isLoadingName.value = loading
break
case 2: ...
case 3:..
}
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.
Good job ya Omar :)
isLoadingNode.value = false; | ||
isLoadingName.value = false; | ||
isLoadingRent.value = false; | ||
updateLoadingTableValue(true, false); |
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.
IMO. To improve code readability and maintainability, consider introducing an object instead of using named parameters.
// Define a type for the options
type ContractsLoadingOptions = {
updateAllTables: boolean;
loading: boolean;
contractType?: boolean;
}
function updateContractsLoading(options: ContractsLoadingOptions) {}
// Example call
updateContractsLoading({
updateAllTables: true,
loading: false,
});
Description
the issue was that we were set loading for other table to false before it already done and it shows no data for while before finish listing its contract
Changes
add new function that handle updating loading value of tables
Related Issues
Documentation PR
For UI changes, Please provide the Documetation PR on info_grid
Screencast.from.28.2024.EEST.05.43.03.webm
Checklist