@stoker-platform/web-app 0.5.192 → 0.5.194

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.194
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: allow Dashboard elements to query the server in preload cache mode
8
+ - Updated dependencies
9
+ - @stoker-platform/web-client@0.5.79
10
+ - @stoker-platform/node-client@0.5.77
11
+ - @stoker-platform/utils@0.5.68
12
+
13
+ ## 0.5.193
14
+
15
+ ### Patch Changes
16
+
17
+ - feat: improve Dashboard reminder sorting
18
+
3
19
  ## 0.5.192
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.192",
3
+ "version": "0.5.194",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.8",
53
53
  "@sentry/react": "^10.56.0",
54
- "@stoker-platform/node-client": "0.5.76",
55
- "@stoker-platform/utils": "0.5.67",
56
- "@stoker-platform/web-client": "0.5.78",
54
+ "@stoker-platform/node-client": "0.5.77",
55
+ "@stoker-platform/utils": "0.5.68",
56
+ "@stoker-platform/web-client": "0.5.79",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
@@ -61,7 +61,7 @@ export const DashboardMetric = ({ metric, title, collection }: DashboardMetricPr
61
61
 
62
62
  useEffect(() => {
63
63
  debouncedSetIsLoading(true)
64
- getData(collectionSchema, constraints, debouncedSetIsLoading, setResults, setUnsubscribe)
64
+ getData(collectionSchema, constraints, debouncedSetIsLoading, setResults, setUnsubscribe, metric.forceServer)
65
65
  return () => {
66
66
  unsubscribe?.forEach((unsubscribe) => unsubscribe())
67
67
  if (loadingTimeoutRef.current) {
@@ -48,6 +48,10 @@ export const DashboardReminder = ({ reminder, title, collection }: DashboardRemi
48
48
  const [rowHighlight, setRowHighlight] = useState<RowHighlight[] | undefined>(undefined)
49
49
  const pages = 5
50
50
 
51
+ const setResultsCallback = useCallback((results: StokerRecord[]) => {
52
+ setResults(reminder.filter ? results.filter((result) => reminder.filter?.(result)) : results)
53
+ }, [])
54
+
51
55
  const loadingTimeoutRef = useRef<NodeJS.Timeout | null>(null)
52
56
  const debouncedSetIsLoading = useCallback((loading: boolean) => {
53
57
  if (loading) {
@@ -95,7 +99,14 @@ export const DashboardReminder = ({ reminder, title, collection }: DashboardRemi
95
99
  }
96
100
  initialize()
97
101
  debouncedSetIsLoading(true)
98
- getData(collectionSchema, constraints, debouncedSetIsLoading, setResults, setUnsubscribe)
102
+ getData(
103
+ collectionSchema,
104
+ constraints,
105
+ debouncedSetIsLoading,
106
+ setResultsCallback,
107
+ setUnsubscribe,
108
+ reminder.forceServer,
109
+ )
99
110
  return () => {
100
111
  unsubscribe?.forEach((unsubscribe) => unsubscribe())
101
112
  if (loadingTimeoutRef.current) {
@@ -11,6 +11,7 @@ export const getData = async (
11
11
  setLoading: (loading: boolean) => void,
12
12
  setResults: (results: StokerRecord[]) => void,
13
13
  setUnsubscribe: (value: React.SetStateAction<Unsubscribe[] | undefined>) => void,
14
+ forceServer?: boolean,
14
15
  ) => {
15
16
  const { labels } = collection
16
17
  const isPreloadCacheEnabled = preloadCacheEnabled(collection)
@@ -65,7 +66,10 @@ export const getData = async (
65
66
  }
66
67
  resolve()
67
68
  },
68
- { constraints: currentQuery.constraints as QueryConstraint[] },
69
+ {
70
+ constraints: currentQuery.constraints as QueryConstraint[],
71
+ only: forceServer ? "default" : undefined,
72
+ },
69
73
  )
70
74
  const { unsubscribe: newUnsubscribe } = result
71
75
  promiseLoaded = true