Skip to content

Refactor `user_popover.vue` loading logic

Summary

In app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue

Currently we have 3 computed properties for checking various loading states:

  • nameIsLoading
  • workInformationIsLoading
  • locationIsLoading

But they could be combined into one computed property as the single source of truth is user.loaded

Also there is a loaded prop that is no longer being used and should be removed.

See threads here for more context:

Improvements

Replace these computed properties:

  • nameIsLoading
  • workInformationIsLoading
  • locationIsLoading

with

userIsLoading() {
  return !this.user.loaded
}

And use userIsLoading in the template to either show the skeleton or the data.

Risks

User popover

Involved components

app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue

Edited by Peter Hegman