Page MenuHomePhabricator

Changing the filters in one tab should not discard results in other tabs
Closed, ResolvedPublicBUG REPORT

Description

Each tab in the media search interface supports a different set of filters which can be used to modify the search.

Changing the active filters in one tab should not impact the results or filter status in other tabs.

Steps to Reproduce:

  1. Enter a search term and allow the results to load in one tab (images, for example).
  2. Set a filter in this tab (example: file type = tiff)
  3. Navigate to a different tab (example: video) and allow the results to load again
  4. Set a file type filter in this tab (example: webm)
  5. Navigate back to the first tab (images)

Actual Results:
The initial (image) results have been discarded and must be reloaded. The filter selection (tiff) persists, however.

Expected Results:
Previously loaded results in the initial tab (images) should persist, and switching back to this tab from a different one should just trigger additional results to be appended to the batch here. Filter selection in this tab should remain unchanged.

Event Timeline

egardner added a subscriber: mwilliams.

@mwilliams thoughts? We talked about things working differently in our slack convo, but the more I think about it the more I feel that this behavior is what most users would actually expect.

Right now the reason this is happening is that in the App.vue component, we have the following code:

<wbmi-tabs :active="currentTab" @tab-change="onTabChange">
	<wbmi-tab v-for="tab in tabs"
		:key="tab"
		:name="tab"
		:title="tabNames[ tab ]">

		<!-- Display search filters for each tab. -->
		<search-filters
			:media-type="tab"
			@filter-change="performNewSearch"
		>
		</search-filters>

	<!-- other stuff... -->
        </wbmi-tab>
</wbmi-tabs>

Translation: a v-for directive loops through all the different media types and builds a tab in the UI; each tab has a <search-filters> component embedded inside of it.

The App component listens for filter-change events on all of these <search-filters> components, and every time such an event is detected the performNewSearch() method is called. This method discards existing search results and performs a new search using the current term, media type (based on the active tab), and any relevant filters which have been set.

The problem is that the current code is not differentiating between filter-change events which happen on different tabs. Instead, any filter change from any tab triggers the performNewSearch method, causing results in tabs where no filters have changed to be unnecessarily discarded.

Change 623675 had a related patch set uploaded (by Eric Gardner; owner: Eric Gardner):
[mediawiki/extensions/WikibaseMediaInfo@master] Only reset results for the current media type when filters change

https://gerrit.wikimedia.org/r/623675

Change 623675 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Only reset results for the current media type when filters change

https://gerrit.wikimedia.org/r/623675

Etonkovidova added a subscriber: Etonkovidova.

Checked in betalabs - moved to Verify in production.