@stoker-platform/web-app 0.5.150 → 0.5.152

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.152
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: allow for missing values in relation sort
8
+
9
+ ## 0.5.151
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: process preloaded collection page number change immediately
14
+
3
15
  ## 0.5.150
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.150",
3
+ "version": "0.5.152",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
package/src/List.tsx CHANGED
@@ -740,23 +740,18 @@ export function List({
740
740
  const field = getField(fields, columnId)
741
741
  if (!isRelationField(field)) return 0
742
742
  const titleField = field.titleField
743
+ let rawA: string
744
+ let rawB: string
743
745
  if (titleField) {
744
- return (Object.values(rowA.original[field.name])[0] as StokerRecord)[titleField].toLowerCase() >
745
- (Object.values(rowB.original[field.name])[0] as StokerRecord)[titleField].toLowerCase()
746
- ? 1
747
- : (Object.values(rowA.original[field.name])[0] as StokerRecord)[titleField].toLowerCase() <
748
- (Object.values(rowB.original[field.name])[0] as StokerRecord)[titleField].toLowerCase()
749
- ? -1
750
- : 0
746
+ const recordA = Object.values(rowA.original[field.name] ?? {})[0] as StokerRecord | undefined
747
+ const recordB = Object.values(rowB.original[field.name] ?? {})[0] as StokerRecord | undefined
748
+ rawA = recordA?.[titleField]?.toString().toLowerCase() ?? ""
749
+ rawB = recordB?.[titleField]?.toString().toLowerCase() ?? ""
751
750
  } else {
752
- return (Object.keys(rowA.original[field.name])[0] as string) >
753
- (Object.keys(rowB.original[field.name])[0] as string)
754
- ? 1
755
- : (Object.keys(rowA.original[field.name])[0] as string) <
756
- (Object.keys(rowB.original[field.name])[0] as string)
757
- ? -1
758
- : 0
751
+ rawA = (Object.keys(rowA.original[field.name] ?? {})[0] ?? "").toLowerCase()
752
+ rawB = (Object.keys(rowB.original[field.name] ?? {})[0] ?? "").toLowerCase()
759
753
  }
754
+ return rawA > rawB ? 1 : rawA < rawB ? -1 : 0
760
755
  },
761
756
  dateSortingFn: (rowA, rowB, columnId) => {
762
757
  const valueA = getSortingValue(
@@ -812,11 +807,13 @@ export function List({
812
807
  const timer = setTimeout(() => {
813
808
  if (isInitialized && fullTextSearch && !isPreloadCacheEnabled && !isServerReadOnly) {
814
809
  backToStart()
815
- } else if (isInitialized && (isPreloadCacheEnabled || isServerReadOnly)) {
816
- setPageIndex(0)
817
- setState(`collection-page-number-${labels.collection.toLowerCase()}`, "page", 1)
818
810
  }
819
811
  }, 750)
812
+
813
+ if (isInitialized && (isPreloadCacheEnabled || isServerReadOnly)) {
814
+ setPageIndex(0)
815
+ setState(`collection-page-number-${labels.collection.toLowerCase()}`, "page", 1)
816
+ }
820
817
  return () => clearTimeout(timer)
821
818
  }, [search])
822
819