@statezero/core 0.1.34 → 0.1.35

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.
@@ -57,17 +57,7 @@ export function QuerySetAdaptor(liveQuerySet, reactivityFn = reactive) {
57
57
  const cacheKey = queryset.semanticKey;
58
58
  // Check the cache first
59
59
  if (cacheKey && wrappedQuerysetCache.has(cacheKey)) {
60
- const cachedWrapper = wrappedQuerysetCache.get(cacheKey);
61
- // Refresh the cached wrapper with current data
62
- const freshData = [...liveQuerySet];
63
- if (reactivityFn === ref) {
64
- cachedWrapper.value = freshData;
65
- }
66
- else {
67
- cachedWrapper.splice(0, cachedWrapper.length);
68
- cachedWrapper.push(...freshData);
69
- }
70
- return cachedWrapper;
60
+ return wrappedQuerysetCache.get(cacheKey);
71
61
  }
72
62
  const querysetAst = queryset.build();
73
63
  // Make the queryset reactive using the specified function
@@ -89,10 +79,10 @@ export function QuerySetAdaptor(liveQuerySet, reactivityFn = reactive) {
89
79
  // Subscribe to queryset events indefinitely
90
80
  querysetEventEmitter.on(eventName, renderHandler);
91
81
  /* Dont delete the innocuous looking queryset.length check. There is some weird interaction
92
- with vue, where when we load an empty queryset from the cache, the reactivity completely breaks.
93
- I wasted over 2 days on this bug, and it won't show up in the e2e tests because it just impacts the
94
- vue reactivity. If this causes performance issues, and needs to be refactored. Make sure you understand
95
- the vue reactivity interaction correctly and find a different way to fix the broken reactivity for empty querysets */
82
+ with vue, where when we load an empty queryset from the cache, the reactivity completely breaks.
83
+ I wasted over 2 days on this bug, and it won't show up in the e2e tests because it just impacts the
84
+ vue reactivity. If this causes performance issues, and needs to be refactored. Make sure you understand
85
+ the vue reactivity interaction correctly and find a different way to fix the broken reactivity for empty querysets */
96
86
  if (cacheKey && liveQuerySet && liveQuerySet.length > 0) {
97
87
  wrappedQuerysetCache.set(cacheKey, wrapper);
98
88
  }
@@ -108,10 +98,7 @@ export function MetricAdaptor(metric) {
108
98
  const cacheKey = `${configKey}::${modelName}::${metric.metricType}::${metric.field}::${hash(querysetAst)}`;
109
99
  // Check the cache first
110
100
  if (cacheKey && wrappedMetricCache.has(cacheKey)) {
111
- const cachedWrapper = wrappedMetricCache.get(cacheKey);
112
- // Refresh the cached wrapper with current metric value
113
- cachedWrapper.value = metric.value;
114
- return cachedWrapper;
101
+ return wrappedMetricCache.get(cacheKey);
115
102
  }
116
103
  // Create a reactive reference with the initial value
117
104
  const wrapper = ref(metric.value);
@@ -129,7 +116,7 @@ export function MetricAdaptor(metric) {
129
116
  }
130
117
  };
131
118
  // Only listen for metric render events
132
- metricEventEmitter.on("metric::render", metricRenderHandler);
119
+ metricEventEmitter.on('metric::render', metricRenderHandler);
133
120
  // Store in cache
134
121
  if (cacheKey) {
135
122
  wrappedMetricCache.set(cacheKey, wrapper);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "type": "module",
5
5
  "module": "ESNext",
6
6
  "description": "The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate",