Page MenuHomePhabricator

[Bug] Special:MediaSearch UI breaks if no "type" param is present
Closed, ResolvedPublicBUG REPORT

Description

Just noticed this when looking at the latest version of this page on BetaCommons: https://commons.wikimedia.beta.wmflabs.org/wiki/Special:MediaSearch

If you visit Special:MediaSearch without any URL params, the UI fails to load. This is because the shouldShowEmptyState computed property assumes there is always a "current tab". The initial value of currentTab is based on the URL params the user has when they first land on the page.

Fortunately there is an easy fix here: Vue's created hook runs before computed properties are evaluated. This is a good place to default to a particular current tab / search type; the existing watch property will ensure the URL params get updated as well.

Steps to Reproduce:
Visit: https://commons.wikimedia.beta.wmflabs.org/wiki/Special:MediaSearch without any URL params

Actual Results:
UI fails to display

Expected Results:
UI should appear normally

Event Timeline

Change 617493 had a related patch set uploaded (by Eric Gardner; owner: Eric Gardner):
[mediawiki/extensions/WikibaseMediaInfo@master] Initialize UI with default "bitmap" tab if none specified

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

Change 617493 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Initialize UI with default "bitmap" tab if none specified

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

Etonkovidova subscribed.

Checked in wmf.3 - seems to be fixed.