PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.10
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.10
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
← All changes | includes/widgets/widget-starter.php +11 -3 1.1.31.1.10 View file →
@@ -83,11 +83,19 @@
83 83 wp_register_script(
84 84 'os-starter-widget', // Handle name — passed as 'script' to openstation_register_widget().
85 85 OPENSTATION_URL . 'assets/js/widget-starter' . $suffix . '.js',
86 86 array( 'wp-api-fetch' ), // List WordPress script handles your widget depends on.
87 - // 'wp-api-fetch' is available on every admin page and handles
88 - // REST nonces automatically. Remove it if your widget does
89 - // not make REST API calls.
87 + // Declare every WordPress package you use, and do not assume any
88 + // of them are already on the page. They used to be: Core's ⌘K
89 + // palette pulled the whole Gutenberg runtime onto every admin
90 + // screen, so `wp.apiFetch`, `wp.element` and friends happened to
91 + // be globals by the time any widget mounted. Deferring that
92 + // runtime to the first ⌘K took the accident away — on a fresh
93 + // boot they are undefined until the palette is opened, and a
94 + // widget that reached for one at mount threw. A declared
95 + // dependency is resolved by WordPress when the script is
96 + // enqueued, which is why this line is the fix and not a
97 + // workaround. See docs/migration-wp-package-globals.md.
90 98 file_exists( $js_path ) ? (string) filemtime( $js_path ) : $version,
91 99 true // Load in the footer — always true for widget scripts.
92 100 );
93 101 }