fix(QtDriver): redundant search override #247
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix(QtDriver): redundant search override
Description:
This pull request addresses an issue where the
filter_items
function was being called unnecessarily in the QtDriver class. This function filters assets based on a search term.Expected Behavior:
When the user enters a search term and clicks the search button or presses Enter:
If the search term hasn't changed (i.e., it's the same as the previous search),
filter_items
shouldn't be called again.This check should be bypassed during window initialisation to ensure all assets are initially visible.
Previous Behavior:
filter_items
was called regardless of whether the search term had changed, leading to redundant filtering.Changes Introduced:
A new variable, previous_search_string, is introduced.
When the user performs a search:previous_search_string is set to the current search term.
Before calling
filter_items
:The code checks if previous_search_string is the same as the current search term.
If they are the same and the window is not initializing,
filter_items
is skipped.An override flag is added for functions that call
filter_items
during window initialisation to bypass the check and ensure all assets are displayed.Benefits:
Testing:
Manual testing has been conducted to ensure the fix functions as intended.
Please review the code changes and provide feedback.