Skip to content

Commit 6eb4438

Browse files
authored
fix(ui): relationship cells in table from list drawer not shown (#7730)
Also a nice performance improvement. The list drawer was previously fetching data with depth 1. This will cause the relationship cell to break, as it expects the relationship data to be a string/number, not a populated object with the id inside. Now, it fetches using depth 0 - same as the normal list view
1 parent 2d6e7f8 commit 6eb4438

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/ui/src/elements/ListDrawer/DrawerContent.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ export const ListDrawerContent: React.FC<ListDrawerProps> = ({
131131
const isOpen = isModalOpen(drawerSlug)
132132
const apiURL = isOpen ? `${serverURL}${api}/${selectedCollectionConfig.slug}` : null
133133
const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0) // used to force a re-fetch even when apiURL is unchanged
134-
const [{ data, isError, isLoading: isLoadingList }, { setParams }] = usePayloadAPI(apiURL, {})
134+
const [{ data, isError, isLoading: isLoadingList }, { setParams }] = usePayloadAPI(apiURL, {
135+
initialParams: {
136+
depth: 0,
137+
},
138+
})
135139
const moreThanOneAvailableCollection = enabledCollectionConfigs.length > 1
136140

137141
useEffect(() => {
@@ -142,13 +146,16 @@ export const ListDrawerContent: React.FC<ListDrawerProps> = ({
142146
} = selectedCollectionConfig
143147
const params: {
144148
cacheBust?: number
149+
depth?: number
145150
draft?: string
146151
limit?: number
147152
page?: number
148153
search?: string
149154
sort?: string
150155
where?: unknown
151-
} = {}
156+
} = {
157+
depth: 0,
158+
}
152159

153160
let copyOfWhere = { ...(where || {}) }
154161
const filterOption = filterOptions?.[slug]

0 commit comments

Comments
 (0)