Commit 127e41a
authored
fix(ui): relationship add button unsafe permissions property access (#14903)
### What?
Fix crashing due to unsafe permissions property access in
`AddNewRelation` by safely checking that a collection’s permissions
exist before reading its `create` property.
### Why?
Accessing `permissions.collections[slug].create` throws and breaks the
UI when a collection’s permissions entry is missing.
This happens for example when collection‑level access control makes that
collection inaccessible.
### How?
Change the condition to use optional chaining on the permissions,
aligning with usage elsewhere in the codebase:
- Before: `permissions.collections[relatedCollection?.slug].create`
- After: `permissions.collections[relatedCollection?.slug]?.create`1 parent 3a1eb77 commit 127e41a
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
0 commit comments