@stoker-platform/web-app 0.5.148 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.5.148
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.148",
3
+ "version": "0.5.149",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
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, 10),
325
+ [field]: data.records.slice(0, numberOfResults),
326
326
  }))
327
327
  }
328
328
  setLoadingImmediate((prev) => ({
package/src/Form.tsx CHANGED
@@ -2021,13 +2021,13 @@ function RelationField({
2021
2021
  }).then((data) => {
2022
2022
  clearTimeout(pickerDebounceTimeout.current)
2023
2023
 
2024
+ const numberOfResults = isCollectionPreloadCacheEnabled && isMobile ? 20 : 10
2024
2025
  if (isCollectionPreloadCacheEnabled && query) {
2025
2026
  const searchResults = localFullTextSearch(relationCollection, query, data.records, (result) => {
2026
2027
  if (!fieldCustomization.admin?.filterResults) return true
2027
2028
  return !!fieldCustomization.admin?.filterResults?.(result, collection, record)
2028
2029
  })
2029
2030
  const objectIds = searchResults.map((result) => result.id)
2030
- const numberOfResults = isMobile ? 20 : 10
2031
2031
  orderData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults)).then(
2032
2032
  (data) => {
2033
2033
  setData(data)
@@ -2045,7 +2045,7 @@ function RelationField({
2045
2045
  record,
2046
2046
  )
2047
2047
  })
2048
- .slice(0, 10),
2048
+ .slice(0, numberOfResults),
2049
2049
  ).then((data) => {
2050
2050
  setData(data)
2051
2051
  })
@@ -139,13 +139,13 @@ export const PermissionPicker = ({
139
139
  }).then((data) => {
140
140
  clearTimeout(pickerDebounceTimeout.current)
141
141
 
142
+ const numberOfResults = isCollectionPreloadCacheEnabled && isMobile ? 20 : 10
142
143
  if (isCollectionPreloadCacheEnabled && query) {
143
144
  const searchResults = localFullTextSearch(collection, query, data.records)
144
145
  const objectIds = searchResults.map((result) => result.id)
145
- const numberOfResults = isMobile ? 20 : 10
146
146
  setData(data.records.filter((doc) => objectIds.includes(doc.id)).slice(0, numberOfResults))
147
147
  } else {
148
- setData(data.records.slice(0, 10))
148
+ setData(data.records.slice(0, numberOfResults))
149
149
  }
150
150
  setIsLoadingImmediate(false)
151
151
  setIsLoading(false)