@stoker-platform/web-app 0.5.90 → 0.5.91

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.91
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: minor fixes to Dashboard and Form
8
+
3
9
  ## 0.5.90
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.90",
3
+ "version": "0.5.91",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
package/src/Dashboard.tsx CHANGED
@@ -15,7 +15,7 @@ import { preloadCacheEnabled } from "./utils/preloadCacheEnabled"
15
15
  import { DashboardReminder } from "./DashboardReminder"
16
16
  import { cn } from "./lib/utils"
17
17
  import { Helmet } from "react-helmet"
18
- import { getField } from "@stoker-platform/utils"
18
+ import { collectionAccess, getField } from "@stoker-platform/utils"
19
19
 
20
20
  export const Dashboard = () => {
21
21
  const globalConfig = getGlobalConfigModule()
@@ -43,7 +43,13 @@ export const Dashboard = () => {
43
43
  setCollectionTitles((prev) => ({ ...prev, [labels.collection]: titles?.collection }))
44
44
  }
45
45
  const metrics = await getCachedConfigValue(globalConfig, ["global", "admin", "dashboard"])
46
- setMetrics(metrics)
46
+ setMetrics(
47
+ metrics.filter((metric: DashboardItem) => {
48
+ const collectionPermissions = permissions?.collections?.[metric.collection]
49
+ if (!collectionPermissions) return false
50
+ return collectionAccess("Read", collectionPermissions)
51
+ }),
52
+ )
47
53
  }
48
54
  initialize()
49
55
  }, [])
package/src/Form.tsx CHANGED
@@ -2266,7 +2266,11 @@ function RelationField({
2266
2266
  collection,
2267
2267
  record,
2268
2268
  )
2269
- : relation[relationCollection.recordTitleField || "id"]}
2269
+ : relation[
2270
+ (field as RelationFieldType).titleField ||
2271
+ relationCollection.recordTitleField ||
2272
+ "id"
2273
+ ]}
2270
2274
  </span>
2271
2275
  </Button>
2272
2276
  <Button
@@ -3212,7 +3216,7 @@ function RecordForm({
3212
3216
  (restriction) => restriction.userRole === permissions.Role && restriction.recordRole.includes(role),
3213
3217
  )
3214
3218
  )
3215
- }, [permissions, record])
3219
+ }, [permissions, record, form.watch("Role")])
3216
3220
 
3217
3221
  useEffect(() => {
3218
3222
  const load = async () => {