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
Allow SearchContainer
implementations to manually trigger a Filter
operation
#5772
Allow SearchContainer
implementations to manually trigger a Filter
operation
#5772
Conversation
Context which should be in the OP but isn't: This is supposed to facilitate the implementation of search box in the mods overlay. The problem is thus: To use The other part of the problem is that So if you have a case wherein the search container filters out all children because they don't match the filter, and then have logic that says "if all children of the search container are hidden, then hide an ancestor of the search container", then if you filter out all children and attempt to unfilter them again, then the column will not unhide, because the filter doesn't run, because it can't as its This is supposed to be a somewhat primitive workaround for this that will allow force-executing the filter instantly on search term change if required. I considered doing this myself, but didn't really want to PR that without exploring better options which never materialised. Also I'm not sure how accurate the sample in the OP is, because I'm pretty sure it only works if you directly hide the @ppy/team-client interested in thoughts on this |
I've reworded the xmldoc here, but have two follow-up questions:
diff --git a/osu.Framework/Graphics/Containers/SearchContainer.cs b/osu.Framework/Graphics/Containers/SearchContainer.cs
index 77c389b48..e9de9e7e4 100644
--- a/osu.Framework/Graphics/Containers/SearchContainer.cs
+++ b/osu.Framework/Graphics/Containers/SearchContainer.cs
@@ -104,9 +104,14 @@ protected override void Update()
///
/// However, if <see cref="SearchContainer{T}"/> or any of its parents are hidden this will not be run.
/// If an implementation relies on filtering to become present / visible, this method can be used to force a filter.
+ ///
+ /// Note that this will only run if the current filter is not in an already valid state.
/// </remarks>
protected void Filter()
{
+ if (filterValid.IsValid)
+ return;
+
canBeShownBindables.Clear();
performFilter();
filterValid.Validate();
|
The mod search implementation hasn't changed very much in that particular respect from how I left it as a rough branch for @Cootz to look at, and that means that overriding presence does nothing to fix it, since it is the The Personally I consider this PR to be a pretty awful escape hatch (as evidenced by the game-side hack which will still be required with this PR - rather than calling |
Yes we can.
Already answered by @bdach, just add that I've spent a lot of time working on this issue as well, and that is the only thing I came up with. P.S. I completely missed the discussion about |
SearchContainer
implementations to manually trigger a Filter
operation
Just in case the `Filter` method is not inlined, and for code readability I'd rather duplciate this here.
As discussed here this PR adds
SearchContainer.Filter
Usage: