feat(ui): use defaultDepth in API view (#11950)
### What? Respects the defaultDepth setting in the admin UI API view. ### Why? The current default is hardcoded to `1` with no configuration option. This can lead to performance issues on documents with a lot of related large documents. Having the ability to define a different default can prevent this issue. ### How? Set the depth in the API view to `config.defaultDepth` as default. Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
This commit is contained in:
@@ -32,6 +32,7 @@ export const APIViewClient: React.FC = () => {
|
||||
|
||||
const {
|
||||
config: {
|
||||
defaultDepth,
|
||||
localization,
|
||||
routes: { api: apiRoute },
|
||||
serverURL,
|
||||
@@ -62,7 +63,9 @@ export const APIViewClient: React.FC = () => {
|
||||
const [data, setData] = React.useState<any>(initialData)
|
||||
const [draft, setDraft] = React.useState<boolean>(searchParams.get('draft') === 'true')
|
||||
const [locale, setLocale] = React.useState<string>(searchParams?.get('locale') || code)
|
||||
const [depth, setDepth] = React.useState<string>(searchParams.get('depth') || '1')
|
||||
const [depth, setDepth] = React.useState<string>(
|
||||
searchParams.get('depth') || defaultDepth.toString(),
|
||||
)
|
||||
const [authenticated, setAuthenticated] = React.useState<boolean>(true)
|
||||
const [fullscreen, setFullscreen] = React.useState<boolean>(false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user