-
Notifications
You must be signed in to change notification settings - Fork 49
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
[-] Smart Field Search - Ease the search on smart fields and deprecate old ways to do it #372
base: main
Are you sure you want to change the base?
Conversation
…e old ways to do it
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.
Is this planed to be exported to the mongoose liana ?
Also I don't see any related clickup / trello card.
Has this been discussed with the product team ?
Is Marc aware he'll need to update the documentation ?
I let you investigate the test failures.
async function getWhere() { | ||
if (!where) { | ||
where = await searchBuilder.perform(params.associationName); | ||
} | ||
return where; | ||
} |
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.
[IMPROVEMENT] I don't like that, the where
value should initialized as the other, no need to create a function.
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.
It's async. So I cannot initialized it like the other 😢
include, | ||
}], | ||
}) | ||
.then((record) => ((record && record[params.associationName]) || [])); | ||
} | ||
|
||
function getCount() { | ||
async function getCount() { |
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.
[SCARED] You are returning a promise of promise (wait for the count value and return it directly instead of returning a promise of the value) and you don't wait for the 'getWhere()' promise value here again. The where
operator expects an object.
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.
A promise of a promise is a promise 🤔
So you can't use |
You are absolutely right. I thought about it, but most of the time includes does not work as expected (For example try with a hasMany...). I think we need to rework a little bit the smart field to add a Tell me what you think about it @arnaudbesnier |
I am not ok to remove flexibility here. The day developers will update to the new (major?) version containing this code, they will potentially lose their Smart Field search feature (if they used I am not fan of the
|
Actually after thinking about it the include is useless as of right now the call is async so you can do your search on the other model if necessary and then do a id in [myListOfId] for example @arnaudbesnier |
Ok, I think this something could also have with the current implementation. What is important is what is removed. |
yeah but like I said it won't work most of the time, because if you try to do it on |
660dc77
to
9f305b9
Compare
Pull Request checklist:
Before
We had to do this kind of thing
After