Plugin Development: List a user’s groups without making a request

You can add custom plugin code to achieve this. Something similar to below code (unverified). Then you can access it like Discourse.User.current().groups

  add_to_serializer(:current_user, :groups, false) {
    object.groups.pluck(:name)
  }