@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.
package/dist/index.mjs CHANGED
@@ -4026,13 +4026,24 @@ var useGetEventsByRegion = (region, options) => {
4026
4026
  };
4027
4027
  };
4028
4028
  var useSearchEvents = (region, search, tags) => {
4029
+ const normalizedSearch = search?.trim() ?? "";
4030
+ const normalizedTags = (tags ?? []).filter(Boolean);
4031
+ const shouldRunQuery = Boolean(region?.trim()) && (normalizedSearch.length > 3 || normalizedTags.length > 0);
4029
4032
  const { loading, error, data, refetch } = useQuery2(SEARCH_EVENTS, {
4030
4033
  fetchPolicy: "network-only",
4031
- skip: !region || region === "",
4032
- variables: { region, search, tags }
4034
+ skip: !shouldRunQuery,
4035
+ variables: {
4036
+ region,
4037
+ search: normalizedSearch,
4038
+ tags: normalizedTags
4039
+ }
4033
4040
  });
4034
- const eventsSearch = data?.eventsSearch || [];
4035
- return { error, eventsSearch, loading, refetch };
4041
+ return {
4042
+ error,
4043
+ eventsSearch: data?.eventsSearch ?? [],
4044
+ loading,
4045
+ refetch
4046
+ };
4036
4047
  };
4037
4048
  var useGetEventsNearMe = (location) => {
4038
4049
  const { loading, error, data, refetch } = useQuery2(GET_EVENTS_NEAR_ME, {