Make WordPress Core

Changeset 62470


Ignore:
Timestamp:
06/06/2026 11:07:09 AM (2 months ago)
Author:
westonruter
Message:

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 https://github.com/WordPress/wordpress-develop/pull/11938.
Follow-up to r41021.

Props mohamedahamed, abduremon, jorbin, ekla, drwpcom, anukasha, huzaifaalmesbah, noruzzaman, rejaulalomkhan, hmbashar, nadabulija, robert681, pedrofigueroa1989, westonruter.
Fixes #65298.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/views/frame/manage.js

    r47122 r62470  
    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
Note: See TracChangeset for help on using the changeset viewer.