Skip to content

Commit

Permalink
chore: use metadata property instead only feature property
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed Aug 7, 2024
1 parent d2bf8ad commit f5857b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions packages/x-components/src/components/base-event-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { defineComponent, PropType, ref } from 'vue';
import { use$x } from '../composables/use-$x';
import { XEvent, XEventsTypes } from '../wiring/events.types';
import { QueryFeature } from '../types/origin';
import { WireMetadata } from '../wiring/index';
/**
* Component to be reused that renders a `<button>` with the logic of emitting events to the bus
Expand All @@ -29,12 +29,12 @@
required: true
},
/**
* The origin property for the request on each query preview.
* The metadata property for the request on each query preview.
*
* @public
*/
queryFeature: {
type: String as PropType<QueryFeature>
metadata: {
type: Object as PropType<Omit<WireMetadata, 'moduleName'>>
}
},
setup(props) {
Expand All @@ -47,7 +47,7 @@
*/
function emitEvents() {
Object.entries(props.events).forEach(([event, payload]) =>
$x.emit(event as XEvent, payload, { target: rootRef.value, feature: props.queryFeature })
$x.emit(event as XEvent, payload, { target: rootRef.value, ...props.metadata })
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/x-components/src/views/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
<QueryPreviewButton
class="x-w-fit x-button-xl x-button-ghost"
:queryPreviewInfo="queryPreviewInfo"
:queryFeature="'customer'"
:metadata="{ feature: 'customer' }"
>
{{ `${queryPreviewInfo.query} (${totalResults})` }}
</QueryPreviewButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<BaseEventButton
v-on="$listeners"
:events="events"
:queryFeature="queryFeature"
:metadata="metadata"
class="x-query-preview-button x-button"
data-test="query-preview-button"
>
Expand All @@ -20,7 +20,7 @@
import { BaseEventButton } from '../../../components';
import { queriesPreviewXModule } from '../x-module';
import { useState } from '../../../composables/use-state';
import { QueryFeature } from '../../../types/origin';
import { WireMetadata } from '../../../wiring/index';
/**
* Component containing an event button that emits
Expand All @@ -46,12 +46,12 @@
required: true
},
/**
* The origin property for the request on each query preview.
* The metadata property for the request on each query preview.
*
* @public
*/
queryFeature: {
type: String as PropType<QueryFeature>
metadata: {
type: Object as PropType<Omit<WireMetadata, 'moduleName'>>
}
},
setup(props) {
Expand Down

0 comments on commit f5857b8

Please sign in to comment.