-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fill quick inserter results with available variations if limit is set and items are less. #24481
Conversation
Size Change: +134 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
* Simplify overall logic * Prioritize base block types, excluding those superseded by isDefault:true block variations
@ntsekouras: following our convo on Slack, I pushed a couple of commits to extend test coverage to default block variations and to ensure consistent business logic in |
Thanks @mcsf! Great simplification 👍 . I just added again the quick exit if items are enough to avoid any iteration at all, given that this is called many times, for example with every search term change. Do you agree? I think we are just missing a case for prioritising the base blocks over variations in case there are fewer or equal items with the limit and there are variations ( no default ) in a block before a block with default variation. I believe it makes it pretty complex to handle this and I don't know if it's worth it TBH. In general there must be some work on improving/enhancing how |
12fc7da
to
9d4f1cf
Compare
Hm... my idea is that we shouldn't be trying to optimise without knowing what needs optimisation. That's because in this function it's clear that, the more straightforward and consistent it is, the more confidence we have in the results. Otherwise (as I commented here) when we optimise we give special treatments to certain values and forget to account for all the business rules. In practice, even if we optimise, we will still need to loop over
Is that still the case now that we have |
I know that @mcsf and I agree and that's why I don't know how much effort we should put in this right now. It should be handled with all the integration of Even my suggestion for prioritizing the I tried some work on prioritzing yesterday but needed feedback whether we should implement this or not. Just for reference an example test is below. Failing test because it removes the
Maybe keep your version for now, remove the last addition of mine and rethink/revisit the What do you think? |
Thanks for your exploring and quick reply!
Yeah, I agree with keeping it simple and not investing too much in the extra requirements. Let's fix |
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.
🚢
Description
There was a refactoring (#24090) in
embed block
that made it a single block with lots ofblock variations
. That surfaced a problem with quick Inserter and the main Inserter when suggesting items with a limit (currently six).A small fix was there to handle the cases where the
limit was set
andthe items where NOT fewer
than the limit.I saw now that when you're searching for items and the filtered results are for example four, it continues to add all the available variations.
This PR handles this case (
limit is set and bigger than items
) and fills the Block list with available variations, if they exist, until it reaches the provided limit.The addition now happens by taking account only the order of variations and there is not a sophisticated handling of which variations to choose. It could/should be handled better when we decide how to handle block variations better.
Steps to reproduce
em
Checklist: