Repository: louislam/uptime-kuma
File: src/components/HeartbeatBar.vue (Vue)

Code before:
                // If maxBeat changed and we're in configured days mode, notify parent to reload data
                if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
                    this.maxBeat = newMaxBeat;

                    // Find the closest parent with reloadHeartbeatData method (StatusPage)
                    let parent = this.$parent;
                    while (parent && !parent.reloadHeartbeatData) {
                        parent = parent.$parent;
                    }
                    if (parent && parent.reloadHeartbeatData) {
                        parent.reloadHeartbeatData(newMaxBeat);
                    }
                } else {
                    this.maxBeat = newMaxBeat;
                }
            }
        },

        /**
         * Get the title of the beat.
         * Used as the hover tooltip on the heartbeat bar.
         * @param {object} beat Beat to get title from
         * @returns {string} Beat title
         */
        getBeatTitle(beat) {
            if (beat === 0 || !beat) {
                return "";
            }

            // Show timestamp for all beats (both individual and aggregated)
            return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`;
        },

        /**
         * Get the aria-label for accessibility
         * @param {object} beat Beat to get aria-label from
         * @returns {string} Aria label
         */
        getBeatAriaLabel(beat) {
            if (beat === 0 || !beat) {
                return "No data";
            }

            const statusText = {
                0: "Down",
                1: "Up",
                2: "Pending",
                3: "Maintenance"
            }[beat.status] || "Unknown";

            return `${statusText} at ${this.$root.datetime(beat.time)}`;

Review comment (suggestion):
there are other occurances of this as well ^^

```suggestion
            if (!beat) {
```

Code after:

                // If maxBeat changed and we're in configured days mode, notify parent to reload data
                if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
                    this.maxBeat = newMaxBeat;

                    // Find the closest parent with reloadHeartbeatData method (StatusPage)
                    let parent = this.$parent;
                    while (parent && !parent.reloadHeartbeatData) {
                        parent = parent.$parent;
                    }
                    if (parent && parent.reloadHeartbeatData) {
                        parent.reloadHeartbeatData(newMaxBeat);
                    }
                } else {
                    this.maxBeat = newMaxBeat;
                }
            }
        },

        /**
         * Get the title of the beat.
         * Used as the hover tooltip on the heartbeat bar.
         * @param {object} beat Beat to get title from
         * @returns {string} Beat title
         */
        getBeatTitle(beat) {
            if (!beat) {
                return "";
            }

            // Show timestamp for all beats (both individual and aggregated)
            return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`;
        },

        /**
         * Get the aria-label for accessibility
         * @param {object} beat Beat to get aria-label from
         * @returns {string} Aria label
         */
        getBeatAriaLabel(beat) {
            switch (beat?.status) {
                case DOWN:
                    return `Down at ${this.$root.datetime(beat.time)}`;
                case UP:
                    return `Up at ${this.$root.datetime(beat.time)}`;
                case PENDING:
                    return `Pending at ${this.$root.datetime(beat.time)}`;
                case MAINTENANCE:
                    return `Maintenance at ${this.$root.datetime(beat.time)}`;
                default:
                    return "No data";