From 32b9b14c56a0228a65a055d634d08efd2f47b897 Mon Sep 17 00:00:00 2001 From: varodv <72568818+alvarodE@users.noreply.github.com> Date: Mon, 6 May 2024 16:53:55 +0200 Subject: [PATCH] Avoid desctructuring on composable props --- .../facets/composables/use-facets.composable.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/x-components/src/x-modules/facets/composables/use-facets.composable.ts b/packages/x-components/src/x-modules/facets/composables/use-facets.composable.ts index 9d5b14c51b..44c23539a9 100644 --- a/packages/x-components/src/x-modules/facets/composables/use-facets.composable.ts +++ b/packages/x-components/src/x-modules/facets/composables/use-facets.composable.ts @@ -7,15 +7,13 @@ import { FiltersByFacet } from '../store/types'; /** * Composable to share Facets logic. * - * @param params - Composable params. + * @param params - Composable props. + * @param props * @returns Composable. * * @public */ -export function useFacets({ - facetsIds, - alwaysVisible = false -}: { +export function useFacets(props: { /** Array of facets ids used to get the selected filters for those facets. */ facetsIds?: Array; /** Flag to render the component even if there are no filters selected. */ @@ -39,8 +37,8 @@ export function useFacets({ * @returns Array of selected filters depends on there are facets ids or not. */ const selectedFilters = computed(() => { - if (facetsIds) { - return (facetsIds as string[]).reduce( + if (props.facetsIds) { + return (props.facetsIds as string[]).reduce( (selectedFilters, facetId) => [ ...selectedFilters, ...selectedFiltersByFacet.value[facetId] @@ -65,7 +63,7 @@ export function useFacets({ * @returns True whenever alwaysVisible is true or has selected filters. False * otherwise. */ - const isVisible = computed(() => alwaysVisible || hasSelectedFilters.value); + const isVisible = computed(() => !!props.alwaysVisible || hasSelectedFilters.value); return { selectedFiltersByFacet,