Opened 9 years ago
Closed 9 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 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.9.1 |
| Component: | Themes | Version: | 4.9 |
| Severity: | normal | Keywords: | has-patch commit fixed-major |
| Cc: | Focuses: |
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
Themespage - Remove
TwentySixteenandTwentyFifteen, soTwentySeventeenis the only installed theme - Refresh the
Themespage
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
@
9 years ago
- Keywords has-patch commit added; needs-patch removed
- Owner set to
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Seems to me this was introduced in [42029]. Maybe just a matter of uppercase vs. lowercase
SearchView/searchView. /cc @westonruter