@ecency/sdk 1.5.26 → 1.5.27

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.
@@ -4112,8 +4112,10 @@ function getDiscoverCurationQueryOptions(duration) {
4112
4112
  });
4113
4113
  }
4114
4114
  function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "pageviews", "visit_duration"], dateRange) {
4115
+ const sortedDimensions = [...dimensions].sort();
4116
+ const sortedMetrics = [...metrics].sort();
4115
4117
  return queryOptions({
4116
- queryKey: ["analytics", "page-stats", url, dimensions, metrics, dateRange],
4118
+ queryKey: ["analytics", "page-stats", url, sortedDimensions, sortedMetrics, dateRange],
4117
4119
  queryFn: async ({ signal }) => {
4118
4120
  const response = await fetch(CONFIG.privateApiHost + "/api/stats", {
4119
4121
  method: "POST",
@@ -4133,7 +4135,9 @@ function getPageStatsQueryOptions(url, dimensions = [], metrics = ["visitors", "
4133
4135
  }
4134
4136
  return response.json();
4135
4137
  },
4136
- enabled: !!url
4138
+ enabled: !!url,
4139
+ // Analytics data should always be fresh - users expect current stats when changing range
4140
+ staleTime: 0
4137
4141
  });
4138
4142
  }
4139
4143