From 087a4bad528e0594e1781d099bc7c613aada22ac Mon Sep 17 00:00:00 2001 From: acondal Date: Wed, 5 Jun 2024 18:34:45 +0200 Subject: [PATCH] feat(base-grid): return [] as default --- packages/x-components/src/components/base-grid.vue | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/x-components/src/components/base-grid.vue b/packages/x-components/src/components/base-grid.vue index fc72379a03..9b2b0392d2 100644 --- a/packages/x-components/src/components/base-grid.vue +++ b/packages/x-components/src/components/base-grid.vue @@ -114,7 +114,7 @@ * * @internal */ - const injectedListItems = inject | []>(LIST_ITEMS_KEY as string, []); + const injectedListItems = inject>(LIST_ITEMS_KEY as string, []); const gridEl = ref(null); @@ -140,14 +140,8 @@ * * @public */ - const computedItems = computed((): ListItem[] | void => { - return ( - props.items ?? - injectedListItems?.value ?? - //TODO: add here logger - //eslint-disable-next-line no-console - console.warn('It is necessary to pass a prop or inject the list of filters') - ); + const computedItems = computed((): ListItem[] | [] | void => { + return props.items ?? injectedListItems?.value.length ? injectedListItems?.value : []; }); /**