@capillarytech/blaze-ui 1.0.3-alpha.12 → 1.0.3-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -20653,6 +20653,13 @@ const CapUnifiedSelect = _ref4 => {
20653
20653
  return;
20654
20654
  }
20655
20655
 
20656
+ // Don't check for missing values if options array is empty
20657
+ // This prevents false positives during initial render before data is fetched
20658
+ // Only check once options have been loaded (options.length > 0)
20659
+ if (options.length === 0) {
20660
+ return;
20661
+ }
20662
+
20656
20663
  // Get current selected values
20657
20664
  const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
20658
20665
  if (selectedValues.length === 0) {
@@ -21452,7 +21459,8 @@ const CapUnifiedSelect = _ref4 => {
21452
21459
  lastSearchQueryRef.current = ''; // Clear search query ref
21453
21460
  }
21454
21461
  // Call resetData to allow developer to reload initial data
21455
- if (resetData) {
21462
+ // Only call if options array is not empty
21463
+ if (resetData && mergedOptions.length > 0) {
21456
21464
  // Store current options before calling resetData to detect when they update
21457
21465
  prevOptionsBeforeResetRef.current = mergedOptions;
21458
21466
  setIsResettingData(true);
@@ -21470,7 +21478,8 @@ const CapUnifiedSelect = _ref4 => {
21470
21478
  onChange == null || onChange(cleared);
21471
21479
  setDropdownOpen(false);
21472
21480
  // Call resetData to allow developer to reload initial data
21473
- if (resetData) {
21481
+ // Only call if options array is not empty
21482
+ if (resetData && options.length > 0) {
21474
21483
  // Store current options before calling resetData to detect when they update
21475
21484
  prevOptionsBeforeResetRef.current = options;
21476
21485
  setIsResettingData(true);
@@ -21551,7 +21560,8 @@ const CapUnifiedSelect = _ref4 => {
21551
21560
  // Only call resetData if user actually interacted (selected, searched, etc.)
21552
21561
  // and resetData hasn't been called already in this session
21553
21562
  // This prevents multiple API calls when user just opens/closes without interaction
21554
- if (resetData && hasInteractedRef.current && !resetDataCalledRef.current) {
21563
+ // Only call if options array is not empty
21564
+ if (resetData && hasInteractedRef.current && !resetDataCalledRef.current && options.length > 0) {
21555
21565
  // Store current options before calling resetData to detect when they update
21556
21566
  prevOptionsBeforeResetRef.current = options;
21557
21567
  setIsResettingData(true);
@@ -21934,8 +21944,9 @@ const CapUnifiedSelect = _ref4 => {
21934
21944
  }
21935
21945
 
21936
21946
  // If value is cleared (becomes undefined), call resetData
21947
+ // Only call if options array is not empty
21937
21948
  if (newValue === undefined || newValue === null) {
21938
- if (resetData) {
21949
+ if (resetData && options.length > 0) {
21939
21950
  // Store current options before calling resetData to detect when they update
21940
21951
  prevOptionsBeforeResetRef.current = options;
21941
21952
  setIsResettingData(true);
@@ -21956,8 +21967,9 @@ const CapUnifiedSelect = _ref4 => {
21956
21967
  hasInteractedRef.current = true;
21957
21968
  }
21958
21969
  // If value is cleared (becomes empty array or undefined), call resetData
21970
+ // Only call if options array is not empty
21959
21971
  if (newValue === undefined || newValue === null || Array.isArray(newValue) && newValue.length === 0) {
21960
- if (resetData) {
21972
+ if (resetData && options.length > 0) {
21961
21973
  // Store current options before calling resetData to detect when they update
21962
21974
  prevOptionsBeforeResetRef.current = options;
21963
21975
  setIsResettingData(true);