Opened 7 years ago
Closed 7 years ago
#42673 closed defect (bug) (fixed)
Themes page throws console error when there is only one installed theme
Reported by: | kouratoras | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9.1 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Themes | Keywords: | has-patch commit fixed-major |
Focuses: | Cc: |
Description
In WordPress 4.9 fresh installation, when there is only one theme available in Themes
page, a console error is thrown.
Steps to reproduce
- Install WordPress
- Go to
Themes
page - Remove
TwentySixteen
andTwentyFifteen
, soTwentySeventeen
is the only installed theme - Refresh the
Themes
page
What I see: The page is throwing a console error:
Uncaught TypeError: Cannot read property 'doSearch' of undefined at Object.init (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,thickbox,underscore,backbone,wp-util,wp-backbone,wp-a11y,customize-base,theme,updates,svg-painter,h&load[]=eartbeat,wp-auth-check&ver=4.9:355) at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,thickbox,underscore,backbone,wp-util,wp-backbone,wp-a11y,customize-base,theme,updates,svg-painter,h&load[]=eartbeat,wp-auth-check&ver=4.9:355) at i (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9:2) at Object.fireWith [as resolveWith] (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9:2) at Function.ready (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9:2) at HTMLDocument.K (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9:2)
Attachments (1)
Change History (9)
#3
@
7 years ago
- Keywords has-patch commit added; needs-patch removed
- Owner set to westonruter
- Status changed from new to accepted
@afercia looks like you're right. 42673.diff does appear to fix the issue that [42029] introduced.
It makes sense why this error is only happening when there is a single theme installed because of the condition that short-circuits when there is only one theme installed: https://github.com/WordPress/wordpress-develop/blob/a687253cce384f6f2e1d921ca6be639431a52e93/src/wp-admin/js/theme.js#L96-L99
When that short-circuit happens, then the searchView
property never gets set, resulting in an error later when it is attempted to be accessed.
#5
@
7 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Seems to me this was introduced in [42029]. Maybe just a matter of uppercase vs. lowercase
SearchView
/searchView
. /cc @westonruter