@stoker-platform/web-app 0.5.156 → 0.5.158
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 +15 -0
- package/package.json +4 -4
- package/src/DateRange.tsx +4 -2
- package/src/utils/expandCache.ts +20 -11
- package/src/utils/prepareCSVData.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.158
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: improve preload cache expansion handling
|
|
8
|
+
|
|
9
|
+
## 0.5.157
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- feat: export datetime fields in correct format
|
|
14
|
+
- @stoker-platform/node-client@0.5.63
|
|
15
|
+
- @stoker-platform/utils@0.5.54
|
|
16
|
+
- @stoker-platform/web-client@0.5.64
|
|
17
|
+
|
|
3
18
|
## 0.5.156
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.158",
|
|
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.50.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.63",
|
|
55
|
+
"@stoker-platform/utils": "0.5.54",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.64",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/DateRange.tsx
CHANGED
|
@@ -51,8 +51,9 @@ export function DateRangeSelector({
|
|
|
51
51
|
const { filters, setFilters } = useFilters()
|
|
52
52
|
const [, setState] = useStokerState()
|
|
53
53
|
const [isInitialized, setIsInitialized] = useState(false)
|
|
54
|
+
const [isExpandingCache, setIsExpandingCache] = useState(false)
|
|
54
55
|
|
|
55
|
-
const { isRouteLoading, isRouteLoadingImmediate } = useRouteLoading()
|
|
56
|
+
const { isRouteLoading, isRouteLoadingImmediate, setIsRouteLoading } = useRouteLoading()
|
|
56
57
|
|
|
57
58
|
useEffect(() => {
|
|
58
59
|
if (filters.length === 0 || isInitialized) return
|
|
@@ -134,7 +135,7 @@ export function DateRangeSelector({
|
|
|
134
135
|
if (!relationList) {
|
|
135
136
|
setState(`collection-range-${labels.collection.toLowerCase()}`, "range", JSON.stringify(value))
|
|
136
137
|
}
|
|
137
|
-
expandCache(collection, value, preloadRange, setPreloadRange)
|
|
138
|
+
expandCache(collection, value, preloadRange, setPreloadRange, setIsExpandingCache, setIsRouteLoading)
|
|
138
139
|
})
|
|
139
140
|
},
|
|
140
141
|
[preloadRange, rangeFilter, rangeSelector, isInitialized, currentField],
|
|
@@ -145,6 +146,7 @@ export function DateRangeSelector({
|
|
|
145
146
|
const disabled =
|
|
146
147
|
isRouteLoading.has(location.pathname) ||
|
|
147
148
|
(isPreloadCacheEnabled && !preloadRange) ||
|
|
149
|
+
(isPreloadCacheEnabled && isExpandingCache) ||
|
|
148
150
|
connectionStatus === "offline" ||
|
|
149
151
|
tryFunction(customization.admin?.disableRangeSelector)
|
|
150
152
|
const preventChange = isRouteLoadingImmediate.has(location.pathname)
|
package/src/utils/expandCache.ts
CHANGED
|
@@ -4,7 +4,7 @@ import cloneDeep from "lodash/cloneDeep.js"
|
|
|
4
4
|
import { getRange } from "@stoker-platform/utils"
|
|
5
5
|
import { getTimezone, preloadCollection } from "@stoker-platform/web-client"
|
|
6
6
|
|
|
7
|
-
export const expandCache = (
|
|
7
|
+
export const expandCache = async (
|
|
8
8
|
collection: CollectionSchema,
|
|
9
9
|
newRange: DateRange,
|
|
10
10
|
preloadRange: DateRange | undefined,
|
|
@@ -16,6 +16,8 @@ export const expandCache = (
|
|
|
16
16
|
| undefined
|
|
17
17
|
>
|
|
18
18
|
>,
|
|
19
|
+
setIsExpandingCache?: React.Dispatch<React.SetStateAction<boolean>>,
|
|
20
|
+
setIsRouteLoading?: (operation: "+" | "-", route: string, immediate?: boolean) => void,
|
|
19
21
|
) => {
|
|
20
22
|
const { labels, preloadCache } = collection
|
|
21
23
|
const timezone = getTimezone()
|
|
@@ -40,16 +42,23 @@ export const expandCache = (
|
|
|
40
42
|
} else if (preloadCacheRangeDates.end) {
|
|
41
43
|
preloadCacheRange.end = preloadRange.to as Date
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
setIsExpandingCache?.(true)
|
|
46
|
+
setIsRouteLoading?.("+", location.pathname, true)
|
|
47
|
+
try {
|
|
48
|
+
await preloadCollection(labels.collection, undefined, preloadCacheRange)
|
|
49
|
+
setPreloadRange((prev) => {
|
|
50
|
+
return {
|
|
51
|
+
...prev,
|
|
52
|
+
[labels.collection]: {
|
|
53
|
+
from: preloadCacheRange.start as Date,
|
|
54
|
+
to: preloadCacheRange.end as Date,
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
} finally {
|
|
59
|
+
setIsExpandingCache?.(false)
|
|
60
|
+
setIsRouteLoading?.("-", location.pathname)
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
}
|
|
@@ -70,7 +70,9 @@ export const prepareCSVData = (collection: CollectionSchema, data: any[]) => {
|
|
|
70
70
|
if (field.type === "Boolean") {
|
|
71
71
|
docData[field.name] = escapeCSVField(doc[field.name] ? "Yes" : "No")
|
|
72
72
|
} else if (field.type === "Timestamp" && doc[field.name]) {
|
|
73
|
-
const formattedDate =
|
|
73
|
+
const formattedDate = tryFunction(fieldCustomization.admin?.time)
|
|
74
|
+
? DateTime.fromJSDate((doc[field.name] as Timestamp).toDate()).toFormat("dd/MM/yy HH:mm")
|
|
75
|
+
: DateTime.fromJSDate((doc[field.name] as Timestamp).toDate()).toFormat(dateFormat)
|
|
74
76
|
docData[field.name] = escapeCSVField(formattedDate)
|
|
75
77
|
} else if (isRelationField(field) && doc[field.name]) {
|
|
76
78
|
const relationCollection = schema.collections[field.collection]
|