Skip to content

Commit

Permalink
feat(base-grid): return [] as default
Browse files Browse the repository at this point in the history
  • Loading branch information
annacv committed Jun 5, 2024
1 parent 89db1ff commit 087a4ba
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/x-components/src/components/base-grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
*
* @internal
*/
const injectedListItems = inject<Ref<ListItem[]> | []>(LIST_ITEMS_KEY as string, []);
const injectedListItems = inject<Ref<ListItem[] | []>>(LIST_ITEMS_KEY as string, []);
const gridEl = ref<ElementRef | HTMLElement | null>(null);
Expand All @@ -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 : [];
});
/**
Expand Down

0 comments on commit 087a4ba

Please sign in to comment.