@stoker-platform/web-app 0.5.157 → 0.5.159

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,17 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.159
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: fix initial map load not showing pins
8
+
9
+ ## 0.5.158
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: improve preload cache expansion handling
14
+
3
15
  ## 0.5.157
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.157",
3
+ "version": "0.5.159",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
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/Map.tsx CHANGED
@@ -431,10 +431,10 @@ export function Map({
431
431
  }, [list, prevList, markers, recordTitleField, mapConfig])
432
432
 
433
433
  useEffect(() => {
434
- if (isLoaded && list) {
434
+ if (isLoaded && list && isMapReady) {
435
435
  fetchMarkers()
436
436
  }
437
- }, [list])
437
+ }, [list, isMapReady])
438
438
 
439
439
  const noLocationRecords = useMemo(() => {
440
440
  if (!mapConfig || !list) return []
@@ -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
- preloadCollection(labels.collection, undefined, preloadCacheRange)
44
- setPreloadRange((prev) => {
45
- return {
46
- ...prev,
47
- [labels.collection]: {
48
- from: preloadCacheRange.start as Date,
49
- to: preloadCacheRange.end as Date,
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
  }