@stoker-platform/web-app 0.5.147 → 0.5.149
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 +12 -0
- package/package.json +1 -1
- package/src/Filters.tsx +3 -3
- package/src/Form.tsx +5 -4
- package/src/PermissionPicker.tsx +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.149
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: apply isMobile condition on intial retrieval
|
|
8
|
+
|
|
9
|
+
## 0.5.148
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: add isMobile to data retrieval function dependency arrays
|
|
14
|
+
|
|
3
15
|
## 0.5.147
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
package/src/Filters.tsx
CHANGED
|
@@ -311,10 +311,10 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
311
311
|
}).then((data) => {
|
|
312
312
|
clearTimeout(pickerDebounceTimeout.current)
|
|
313
313
|
|
|
314
|
+
const numberOfResults = isCollectionPreloadCacheEnabled && isMobile ? 20 : 10
|
|
314
315
|
if (isCollectionPreloadCacheEnabled && query) {
|
|
315
316
|
const searchResults = localFullTextSearch(collectionSchema, query, data.records)
|
|
316
317
|
const objectIds = searchResults.map((result) => result.id)
|
|
317
|
-
const numberOfResults = isMobile ? 20 : 10
|
|
318
318
|
setData((prev) => ({
|
|
319
319
|
...prev,
|
|
320
320
|
[field]: data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults),
|
|
@@ -322,7 +322,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
322
322
|
} else {
|
|
323
323
|
setData((prev) => ({
|
|
324
324
|
...prev,
|
|
325
|
-
[field]: data.records.slice(0,
|
|
325
|
+
[field]: data.records.slice(0, numberOfResults),
|
|
326
326
|
}))
|
|
327
327
|
}
|
|
328
328
|
setLoadingImmediate((prev) => ({
|
|
@@ -335,7 +335,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
335
335
|
}))
|
|
336
336
|
})
|
|
337
337
|
},
|
|
338
|
-
[],
|
|
338
|
+
[isMobile],
|
|
339
339
|
)
|
|
340
340
|
|
|
341
341
|
const debounceTimeout = useRef<NodeJS.Timeout>()
|
package/src/Form.tsx
CHANGED
|
@@ -1926,6 +1926,8 @@ function RelationField({
|
|
|
1926
1926
|
initialize()
|
|
1927
1927
|
}, [])
|
|
1928
1928
|
|
|
1929
|
+
const isMobile = useIsMobile()
|
|
1930
|
+
|
|
1929
1931
|
const getData = useCallback(
|
|
1930
1932
|
async (query: string | undefined, constraints: [string, "==" | "in", unknown][] = []) => {
|
|
1931
1933
|
setIsLoadingImmediate(true)
|
|
@@ -2019,13 +2021,13 @@ function RelationField({
|
|
|
2019
2021
|
}).then((data) => {
|
|
2020
2022
|
clearTimeout(pickerDebounceTimeout.current)
|
|
2021
2023
|
|
|
2024
|
+
const numberOfResults = isCollectionPreloadCacheEnabled && isMobile ? 20 : 10
|
|
2022
2025
|
if (isCollectionPreloadCacheEnabled && query) {
|
|
2023
2026
|
const searchResults = localFullTextSearch(relationCollection, query, data.records, (result) => {
|
|
2024
2027
|
if (!fieldCustomization.admin?.filterResults) return true
|
|
2025
2028
|
return !!fieldCustomization.admin?.filterResults?.(result, collection, record)
|
|
2026
2029
|
})
|
|
2027
2030
|
const objectIds = searchResults.map((result) => result.id)
|
|
2028
|
-
const numberOfResults = isMobile ? 20 : 10
|
|
2029
2031
|
orderData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults)).then(
|
|
2030
2032
|
(data) => {
|
|
2031
2033
|
setData(data)
|
|
@@ -2043,7 +2045,7 @@ function RelationField({
|
|
|
2043
2045
|
record,
|
|
2044
2046
|
)
|
|
2045
2047
|
})
|
|
2046
|
-
.slice(0,
|
|
2048
|
+
.slice(0, numberOfResults),
|
|
2047
2049
|
).then((data) => {
|
|
2048
2050
|
setData(data)
|
|
2049
2051
|
})
|
|
@@ -2052,7 +2054,7 @@ function RelationField({
|
|
|
2052
2054
|
setIsLoading(false)
|
|
2053
2055
|
})
|
|
2054
2056
|
},
|
|
2055
|
-
[record, form],
|
|
2057
|
+
[record, form, isMobile],
|
|
2056
2058
|
)
|
|
2057
2059
|
|
|
2058
2060
|
const handleOneToChange = useCallback(
|
|
@@ -2114,7 +2116,6 @@ function RelationField({
|
|
|
2114
2116
|
popoverHeight = "h-48"
|
|
2115
2117
|
}
|
|
2116
2118
|
|
|
2117
|
-
const isMobile = useIsMobile()
|
|
2118
2119
|
const { offset: keyboardOffset, viewportHeight } = useKeyboardOffset(isMobile && isOpen)
|
|
2119
2120
|
const sheetHeight = Math.max(240, Math.min(viewportHeight - 16, viewportHeight * 0.9))
|
|
2120
2121
|
|
package/src/PermissionPicker.tsx
CHANGED
|
@@ -74,6 +74,8 @@ export const PermissionPicker = ({
|
|
|
74
74
|
|
|
75
75
|
const pickerDebounceTimeout = useRef<NodeJS.Timeout>()
|
|
76
76
|
|
|
77
|
+
const isMobile = useIsMobile()
|
|
78
|
+
|
|
77
79
|
const getData = useCallback(
|
|
78
80
|
async (query: string | undefined, constraints: [string, "==" | "in", unknown][] = []) => {
|
|
79
81
|
setIsLoadingImmediate(true)
|
|
@@ -137,19 +139,19 @@ export const PermissionPicker = ({
|
|
|
137
139
|
}).then((data) => {
|
|
138
140
|
clearTimeout(pickerDebounceTimeout.current)
|
|
139
141
|
|
|
142
|
+
const numberOfResults = isCollectionPreloadCacheEnabled && isMobile ? 20 : 10
|
|
140
143
|
if (isCollectionPreloadCacheEnabled && query) {
|
|
141
144
|
const searchResults = localFullTextSearch(collection, query, data.records)
|
|
142
145
|
const objectIds = searchResults.map((result) => result.id)
|
|
143
|
-
const numberOfResults = isMobile ? 20 : 10
|
|
144
146
|
setData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults))
|
|
145
147
|
} else {
|
|
146
|
-
setData(data.records.slice(0,
|
|
148
|
+
setData(data.records.slice(0, numberOfResults))
|
|
147
149
|
}
|
|
148
150
|
setIsLoadingImmediate(false)
|
|
149
151
|
setIsLoading(false)
|
|
150
152
|
})
|
|
151
153
|
},
|
|
152
|
-
[],
|
|
154
|
+
[isMobile],
|
|
153
155
|
)
|
|
154
156
|
|
|
155
157
|
const debounceTimeout = useRef<NodeJS.Timeout>()
|
|
@@ -334,7 +336,6 @@ export const PermissionPicker = ({
|
|
|
334
336
|
popoverHeight = "h-48"
|
|
335
337
|
}
|
|
336
338
|
|
|
337
|
-
const isMobile = useIsMobile()
|
|
338
339
|
const { offset: keyboardOffset, viewportHeight } = useKeyboardOffset(isMobile && isOpen)
|
|
339
340
|
const sheetHeight = Math.max(240, Math.min(viewportHeight - 16, viewportHeight * 0.9))
|
|
340
341
|
|