Skip to content

Commit f36e443

Browse files
committed
Media: Reset the URL search parameter when the grid view search is cleared.
The throttled `input` handler in `wp.media.view.MediaFrame.Manage` only called `gridRouter.navigate()` when the search value was non-empty, so emptying the search box left the `?search=` query parameter in the address bar. Reloading the page then re-parsed that stale parameter and refilled the input. So now the `navigate()` method is called unconditionally when the input changes in order to reset the URL back to the base `upload.php`. Developed in WordPress#11938. Follow-up to r41021. Props mohamedahamed, abduremon, jorbin, ekla, drwpcom, anukasha, huzaifaalmesbah, noruzzaman, rejaulalomkhan, hmbashar, nadabulija, robert681, pedrofigueroa1989, westonruter. Fixes #65298. git-svn-id: https://develop.svn.wordpress.org/trunk@62470 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2784385 commit f36e443

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/js/media/views/frame/manage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ Manage = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Manage.prototype
9898

9999
if ( val ) {
100100
url += '?search=' + val;
101-
this.gridRouter.navigate( this.gridRouter.baseUrl( url ), { replace: true } );
102101
}
102+
103+
this.gridRouter.navigate( this.gridRouter.baseUrl( url ), { replace: true } );
103104
}, 1000 );
104105

105106
// Update the URL when entering search string (at most once per second).

0 commit comments

Comments
 (0)