-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: query preview components allow adding extra params to the request #1270
feat: query preview components allow adding extra params to the request #1270
Conversation
packages/x-components/src/x-modules/query-suggestions/wiring.ts
Outdated
Show resolved
Hide resolved
Hi, selecting a query preview and then deleting it and selecting another queryPreview with different params is not working properly, params that change between requests are not kept (instance, store in the examples) no matter if the changes proposed are applied or not: Gravacio.de.pantalla.2023-08-29.a.les.16.00.41.mov |
@@ -197,7 +198,11 @@ | |||
protected created(): void { | |||
this.$watch( | |||
() => this.queryPreviewRequest, | |||
request => this.emitQueryPreviewRequestUpdated(request) | |||
(newRequest, oldRequest) => { | |||
if (JSON.stringify(newRequest) !== JSON.stringify(oldRequest)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could use getNewAndUpdatedKeys for this?
@@ -348,8 +353,8 @@ | |||
</h1> | |||
<LocationProvider :location="$x.noResults ? 'no_results' : 'low_results'"> | |||
<QueryPreviewList | |||
:queries="queries" | |||
#default="{ query, results }" | |||
:queries-preview-info="queries.map(q => ({ query: q }))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this to a property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but queries
comes from the scope slot from SemanticQueries
, I can't make it a property. I could move the mapping to a function that receives the queries list.
* | ||
* @internal | ||
*/ | ||
protected get events(): Partial<XEventsTypes> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking if it would make sense to add a prop to allow emit other events that are configured from the outside. I think that approach came handy in the past in some setups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, this component is not much more than a BaseEventButton
, don't know if it's worth it. Will think about it anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
That's a good point to have in mind, but I think we should go on to be able to implement the filters part ASAP.
packages/x-components/src/x-modules/queries-preview/components/query-preview-button.vue
Outdated
Show resolved
Hide resolved
packages/x-components/src/x-modules/queries-preview/components/query-preview-button.vue
Outdated
Show resolved
Hide resolved
packages/x-components/src/x-modules/queries-preview/store/module.ts
Outdated
Show resolved
Hide resolved
…y-preview-with-filters-and-extraparams # Conflicts: # packages/x-components/src/x-modules/queries-preview/components/query-preview.vue
/** | ||
* The selected query preview has changed. | ||
* Payload: The new selected query preview with extra params or the initial module | ||
* params if the query has been cleared. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
If I am not wrong, I think this doc should be updated to be more precise, at least the payload description, as now it is not a change event that will always be fired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
EMP-1555
Motivation and context
We need to gain more control with the parameters that we use to create the query preview requests. Right now we were limited to the query. In this PR we add the feature of making the query preview request with extra params too
Type of change
What is the destination branch of this PR?
Main
How has this been tested?
Select a query preview that has been initialized with custom extra params. Check that the search uses those extra params until it is restarted. Check that the search uses the initial extra params afterwards.