`) for the
+ * React `modules-admin` bundle, plus the noscript and REST-disabled
+ * fallback notices. `Jetpack_Modules_List_Table`'s constructor enqueues
+ * the bundle and localizes the `jetpackModulesData` blob the React app
+ * reads on mount.
+ *
+ * @since $$next-version$$
*/
public function page_render() {
- $list_table = new Jetpack_Modules_List_Table();
+ // `Jetpack_Modules_List_Table::__construct` enqueues the React bundle
+ // and localizes `jetpackModulesData`, so instantiate it for the side
+ // effect.
+ // @phan-suppress-next-line PhanNoopNew -- Constructor enqueues scripts.
+ new Jetpack_Modules_List_Table();
// We have static.html so let's continue trying to fetch the others.
$noscript_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-noscript-notice.html' ); //phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents, Not fetching a remote file.
@@ -82,92 +93,7 @@ public function page_render() {
}
echo $noscript_notice; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
-
-
+
, using the shared jetpack-admin-page-layout mixin. Activate/Deactivate buttons become
; segmented filters use ; Dashboard/Settings move to the AdminPage actions slot. Backbone sources are unenqueued but left in place for a single-commit revert.
diff --git a/projects/plugins/jetpack/changelog/modules-page-url-state-sync b/projects/plugins/jetpack/changelog/modules-page-url-state-sync
new file mode 100644
index 000000000000..8a8a29e10667
--- /dev/null
+++ b/projects/plugins/jetpack/changelog/modules-page-url-state-sync
@@ -0,0 +1,4 @@
+Significance: patch
+Type: enhancement
+
+Modules admin page: persist search/filter/sort/tag in the URL via history.replaceState so a refresh or shared link restores filter state. Defaults are dropped from the URL to keep clean URLs clean.
diff --git a/projects/plugins/jetpack/class.jetpack-modules-list-table.php b/projects/plugins/jetpack/class.jetpack-modules-list-table.php
index ee39f2e5115d..0e894a3395ac 100644
--- a/projects/plugins/jetpack/class.jetpack-modules-list-table.php
+++ b/projects/plugins/jetpack/class.jetpack-modules-list-table.php
@@ -5,8 +5,6 @@
* @package automattic/jetpack
*/
-use Automattic\Jetpack\Assets;
-
if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
@@ -49,57 +47,50 @@ public function __construct() {
Jetpack::get_translated_modules( $this->all_items ),
- 'i18n' => array(
- 'search_placeholder' => __( 'Search modules…', 'jetpack' ),
- ),
- 'modalinfo' => $this->module_info_check( $modal_info, $this->all_items ),
- 'nonces' => array(
- 'bulk' => wp_create_nonce( 'bulk-jetpack_page_jetpack_modules' ),
- ),
- )
- );
+ wp_enqueue_style(
+ 'jetpack-modules-admin',
+ plugins_url( '_inc/build/modules-admin.css', JETPACK__PLUGIN_FILE ),
+ array(),
+ $script_asset['version']
+ );
- wp_enqueue_script( 'jetpack-modules-list-table' );
+ wp_set_script_translations( 'jetpack-modules-admin', 'jetpack' );
+
+ wp_localize_script(
+ 'jetpack-modules-admin',
+ 'jetpackModulesData',
+ array(
+ 'modules' => Jetpack::get_translated_modules( $this->all_items ),
+ 'i18n' => array(
+ 'search_placeholder' => __( 'Search modules…', 'jetpack' ),
+ ),
+ 'modalinfo' => $this->module_info_check( $modal_info, $this->all_items ),
+ 'nonces' => array(
+ 'bulk' => wp_create_nonce( 'bulk-jetpack_page_jetpack_modules' ),
+ ),
+ )
+ );
+ }
/**
* Filters the js_templates callback value.
diff --git a/projects/plugins/jetpack/tools/webpack.config.js b/projects/plugins/jetpack/tools/webpack.config.js
index aa0e7cde5614..95ad27eb86cb 100644
--- a/projects/plugins/jetpack/tools/webpack.config.js
+++ b/projects/plugins/jetpack/tools/webpack.config.js
@@ -158,6 +158,7 @@ module.exports = [
},
'plugins-page': path.join( __dirname, '../_inc/client', 'plugins-entry.js' ),
'network-admin': path.join( __dirname, '../_inc/client', 'network-admin.tsx' ),
+ 'modules-admin': path.join( __dirname, '../_inc/client', 'modules-admin', 'index.tsx' ),
},
plugins: [
...sharedWebpackConfig.plugins,