diff options
Diffstat (limited to 'app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue')
-rw-r--r-- | app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue index 3feff8639a1..87ddbbf256a 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/time_tracker.vue @@ -31,7 +31,11 @@ export default { directives: { GlModal: GlModalDirective, }, - inject: ['issuableType'], + inject: { + issuableType: { + default: null, + }, + }, props: { limitToHours: { type: Boolean, @@ -43,6 +47,11 @@ export default { required: false, default: '', }, + issuableId: { + type: String, + required: false, + default: '', + }, issuableIid: { type: String, required: false, @@ -83,15 +92,18 @@ export default { return timeTrackingQueries[this.issuableType].query; }, skip() { - // We don't fetch info via GraphQL in following cases - // 1. Time tracking info was provided via prop - // 2. issuableIid and fullPath are not provided. - if (!this.initialTimeTracking) { - return false; - } else if (this.issuableIid && this.fullPath) { - return false; + // Skip the query if either of the conditions are true + // 1. issuableType is not provided + // 2. Time tracking info was provided via prop + // 3. issuableIid and fullPath are not provided + if (!this.issuableType || !timeTrackingQueries[this.issuableType]) { + return true; + } else if (this.initialTimeTracking) { + return true; + } else if (!this.issuableIid || !this.fullPath) { + return true; } - return true; + return false; }, variables() { return { @@ -108,7 +120,7 @@ export default { }, computed: { isTimeTrackingInfoLoading() { - return this.$apollo?.queries.issuableTimeTracking.loading ?? false; + return this.$apollo?.queries.issuableTimeTracking?.loading ?? false; }, timeEstimate() { return this.timeTracking?.timeEstimate || 0; @@ -146,7 +158,7 @@ export default { isTimeReportSupported() { return ( [IssuableType.Issue, IssuableType.MergeRequest].includes(this.issuableType) && - this.issuableIid + this.issuableId ); }, }, @@ -240,7 +252,7 @@ export default { :title="__('Time tracking report')" :hide-footer="true" > - <time-tracking-report :limit-to-hours="limitToHours" :issuable-iid="issuableIid" /> + <time-tracking-report :limit-to-hours="limitToHours" :issuable-id="issuableId" /> </gl-modal> </template> <transition name="help-state-toggle"> |