Ensure consistent sorting order for plugin endpoints If multiple plugins register for the same endpoint, then the order was random and could be different on each page load. Let's sort the plugins by name such that the order is at least consistent. But plugins can still not influence the order other than changing the plugin's name. Release-Notes: skip Change-Id: I47cbca7b040ee26e84a3764d12c2840895a2618d
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts index b1b66ad..fa50c53 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts
@@ -138,6 +138,8 @@ * endpoint. */ getDetails(name: string): ModuleInfo[] { - return this._endpoints.get(name) ?? []; + return (this._endpoints.get(name) ?? []).sort((m1, m2) => + m1.plugin.getPluginName().localeCompare(m2.plugin.getPluginName()) + ); } }