Opened 10 years ago
Closed 10 years ago
#30583 closed defect (bug) (fixed)
Switching Media Library Views Clears Search Query
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.0.1 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
When switching from Grid to List view or List to Grid view in the media library while looking at search results, the search query is either lost or ignored. The results I'm seeing are quite inconsistent even in what goes wrong.
Theme & Variations on a Bug
Grid -> List
- Open Media Library in Grid View
- Do a search.
- Switch to list view.
Result: Search is lost. List view shows all items in media library. URL: /wp-admin/upload.php?mode=list
List -> Grid
- Open Media Library in List View
- Do a search.
- Switch to grid view.
Result: Search is lost. Grid view shows all items in media library. URL: /wp-admin/upload.php?mode=grid&attachment-filter&m=0&filter_action=Filter&s={SEARCH_TERM}&action=-1&paged=1&action2=-1&affected&_ajax_nonce=XXXXXXX
Where Things Get Weird: Adding Vars to URL
- Open Media Library in Grid View
- Manually append
?s={SEARCH_TERM}
to URL. HitRETURN
.
Result A: Page reloads showing all items. Not search.
- Switch to Grid View.
Result B: Page loads in grid view with the search applied. What!? URL:/wp-admin/upload.php?s=koala&mode=list
I think I've seen some other weird variations of these things, but those are the three that I can consistently reproduce.
30583.diff persists search across grid/list.
s
is in the URL, all attachments are loaded and then the search value is set, which will filter the attachments. If the page loads with the attachments already filtered, the library will have to be requery'd to get the full set, which will require weirder code.location.href
in the propermode=
context.