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

Code before:

                // Hide children if not filtering
                let showChild = true;
                if (this.filterState.status == null && this.filterState.active == null && this.filterState.tags == null && this.searchText === "") {
                    if (monitor.parent !== null) {
                        showChild = false;
                    }
                }

                return searchTextMatch && statusMatch && activeMatch && tagsMatch && showChild;
            });

            // Filter result by active state, weight and alphabetical
            result.sort((m1, m2) => {

                if (m1.active !== m2.active) {
                    if (m1.active === false) {
                        return 1;
                    }

                    if (m2.active === false) {
                        return -1;
                    }
                }

                if (m1.weight !== m2.weight) {
                    if (m1.weight > m2.weight) {
                        return -1;
                    }

                    if (m1.weight < m2.weight) {
                        return 1;
                    }
                }

                return m1.name.localeCompare(m2.name);
            });

            return result;
        },

        /**
         * Determines if any filters are active.
         *
         * @return {boolean} True if any filter is active, false otherwise.
         */
        filtersActive() {
            return this.filterState.status != null || this.filterState.active != null || this.filterState.tags != null || this.searchText !== "";
        }
    },
    mounted() {

Review comment (suggestion):
You seem to like the "if.. assign" pattern (don't know the real name)

I would argue that this can be simplified to
```suggestion
                const filterCanBeActive = this.filterState.active != null && this.filterState.active.length > 0;
                let activeMatch = !filterCanBeActive || this.filterState.active.includes(monitor.active);
```

(code-style => feel free to overrule ^^)

Code after:
            result = result.filter(monitor => {
                // filter by search text
                // finds monitor name, tag name or tag value
                let searchTextMatch = true;
                if (this.searchText !== "") {
                    const loweredSearchText = this.searchText.toLowerCase();
                    searchTextMatch =
                        monitor.name.toLowerCase().includes(loweredSearchText)
                        || monitor.tags.find(tag => tag.name.toLowerCase().includes(loweredSearchText)
                            || tag.value?.toLowerCase().includes(loweredSearchText));
                }

                // filter by status
                let statusMatch = true;
                if (this.filterState.status != null && this.filterState.status.length > 0) {
                    if (monitor.id in this.$root.lastHeartbeatList && this.$root.lastHeartbeatList[monitor.id]) {
                        monitor.status = this.$root.lastHeartbeatList[monitor.id].status;
                    }
                    statusMatch = this.filterState.status.includes(monitor.status);
                }

                // filter by active
                let activeMatch = true;
                if (this.filterState.active != null && this.filterState.active.length > 0) {
                    activeMatch = this.filterState.active.includes(monitor.active);
                }

                // filter by tags
                let tagsMatch = true;
                if (this.filterState.tags != null && this.filterState.tags.length > 0) {
                    tagsMatch = monitor.tags.map(tag => tag.tag_id) // convert to array of tag IDs
                        .filter(monitorTagId => this.filterState.tags.includes(monitorTagId)) // perform Array Intersaction between filter and monitor's tags
                        .length > 0;
                }

                // Hide children if not filtering
                let showChild = true;
                if (this.filterState.status == null && this.filterState.active == null && this.filterState.tags == null && this.searchText === "") {
                    if (monitor.parent !== null) {
                        showChild = false;
                    }
                }

                return searchTextMatch && statusMatch && activeMatch && tagsMatch && showChild;
            });

            // Filter result by active state, weight and alphabetical
            result.sort((m1, m2) => {
                if (m1.active !== m2.active) {
                    if (m1.active === false) {
                        return 1;