From 8f82e785973500bff2f8f153a58a02d9294ca723 Mon Sep 17 00:00:00 2001
From: Romit <85230081+romitg2@users.noreply.github.com>
Date: Wed, 10 Sep 2025 16:57:56 +0530
Subject: [PATCH] fix: loading skeleton is rendered even when no attributes
filter is selected (#23656)
* fix
* fix tests
* fix tests
* test fidx
* chore
---------
Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
---
packages/features/Segment.test.tsx | 50 ++++++++++++++++++++++++------
packages/features/Segment.tsx | 23 +++++++-------
2 files changed, 52 insertions(+), 21 deletions(-)
diff --git a/packages/features/Segment.test.tsx b/packages/features/Segment.test.tsx
index c26c77e787..cbf93aa49f 100644
--- a/packages/features/Segment.test.tsx
+++ b/packages/features/Segment.test.tsx
@@ -1,4 +1,5 @@
import { render, screen, waitFor } from "@testing-library/react";
+import React from "react";
import { describe, expect, it, vi, beforeEach } from "vitest";
import type { Mock } from "vitest";
@@ -49,9 +50,10 @@ const mockAttributesWithSingleSelect = () => {
slug: "department",
name: "Department",
type: AttributeType.SINGLE_SELECT,
+ isWeightsEnabled: false,
options: [
- { id: "1", value: "Sales", slug: "sales" },
- { id: "2", value: "Engineering", slug: "engineering" },
+ { id: "1", value: "Sales", slug: "sales", contains: [], isGroup: false },
+ { id: "2", value: "Engineering", slug: "engineering", contains: [], isGroup: false },
],
},
],
@@ -85,9 +87,24 @@ vi.mock("@calcom/lib/hooks/useLocale", () => ({
}));
describe("Segment", () => {
+ const defaultQueryValue = {
+ id: "root",
+ type: "group",
+ children1: {
+ "rule-1": {
+ type: "rule",
+ properties: {
+ field: "department",
+ operator: "select_equals",
+ value: ["Sales"],
+ },
+ },
+ },
+ } as AttributesQueryValue;
+
const defaultProps = {
teamId: 1,
- queryValue: null as AttributesQueryValue | null,
+ queryValue: defaultQueryValue,
onQueryValueChange: vi.fn(),
className: "test-class",
};
@@ -132,7 +149,25 @@ describe("Segment", () => {
});
});
- it("shows matching team members when query value is provided", async () => {
+ it("shows no filter selected message when empty query value is provided", async () => {
+ mockGetMatchingTeamMembers({
+ isPending: true,
+ data: undefined,
+ });
+
+ const emptyQueryValue = {
+ id: "root",
+ type: "group",
+ children1: {},
+ } as AttributesQueryValue;
+
+ render(