Skip to content

Commit

Permalink
feat: use XBus Composable
Browse files Browse the repository at this point in the history
  • Loading branch information
annacv committed Feb 26, 2024
1 parent b905727 commit 0cd0688
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import { defineComponent, inject, PropType, onMounted, watch, computed, ComputedRef } from 'vue';
import { defineComponent, PropType, onMounted, watch, computed, ComputedRef } from 'vue';
import { createRawFilters } from '../../../utils/filters';
import { isArrayEmpty } from '../../../utils/array';
import { SnippetConfig } from '../../../x-installer/api/api.types';
import { use$x, useNoElementRender } from '../../../composables/index';
import { useHybridInject, useNoElementRender } from '../../../composables/index';
import { useXBus } from '../../../composables/use-x-bus';
/**
* This component emits {@link FacetsXEvents.PreselectedFiltersProvided} when a preselected filter
Expand All @@ -28,7 +29,8 @@
}
},
setup(props, { slots }) {
const $x = use$x();
// eslint-disable-next-line @typescript-eslint/unbound-method
const { emit } = useXBus();
/**
* Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.
Expand All @@ -53,7 +55,7 @@
*/
const emitPreselectedFilters = (): void => {
if (!isArrayEmpty(preselectedFilters.value)) {
$x.emit('PreselectedFiltersProvided', createRawFilters(preselectedFilters.value));
emit('PreselectedFiltersProvided', createRawFilters(preselectedFilters.value));
}
};
Expand Down

0 comments on commit 0cd0688

Please sign in to comment.