@timardex/cluemart-shared 1.5.547 → 1.5.548

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.
@@ -4,7 +4,7 @@ import {
4
4
  normalizeUrl,
5
5
  timeFormat
6
6
  } from "../chunk-Z3JWNX2U.mjs";
7
- import "../chunk-QEG3EGM6.mjs";
7
+ import "../chunk-XUQ6GKX7.mjs";
8
8
  import {
9
9
  EnumEventDateStatus,
10
10
  EnumEventType,
package/dist/index.cjs CHANGED
@@ -4351,13 +4351,24 @@ var useGetEventsByRegion = (region, options) => {
4351
4351
  };
4352
4352
  };
4353
4353
  var useSearchEvents = (region, search, tags) => {
4354
+ const normalizedSearch = search?.trim() ?? "";
4355
+ const normalizedTags = (tags ?? []).filter(Boolean);
4356
+ const shouldRunQuery = Boolean(region?.trim()) && (normalizedSearch.length > 3 || normalizedTags.length > 0);
4354
4357
  const { loading, error, data, refetch } = (0, import_client19.useQuery)(SEARCH_EVENTS, {
4355
4358
  fetchPolicy: "network-only",
4356
- skip: !region || region === "",
4357
- variables: { region, search, tags }
4359
+ skip: !shouldRunQuery,
4360
+ variables: {
4361
+ region,
4362
+ search: normalizedSearch,
4363
+ tags: normalizedTags
4364
+ }
4358
4365
  });
4359
- const eventsSearch = data?.eventsSearch || [];
4360
- return { error, eventsSearch, loading, refetch };
4366
+ return {
4367
+ error,
4368
+ eventsSearch: data?.eventsSearch ?? [],
4369
+ loading,
4370
+ refetch
4371
+ };
4361
4372
  };
4362
4373
  var useGetEventsNearMe = (location) => {
4363
4374
  const { loading, error, data, refetch } = (0, import_client19.useQuery)(GET_EVENTS_NEAR_ME, {