Skip to content

Commit

Permalink
[Dashboard] Await new services in exported listing table (#195277)
Browse files Browse the repository at this point in the history
Closes #194733

## Summary

In #193644, I forgot to remove
references to the old `servicesReady` promise - this caused an issue
where it never resolved `true`, so anywhere that depended on this would
be stuck in a loading state. This PR fixes this by replacing all
instances of `servicesReady` with the new
`untilPluginStartServicesReady` promise.

Specifically, this fixes the exported `DashboardListingTable` that the
Security page uses:

- **Before:**


https://github.com/user-attachments/assets/78fc8ad8-7bff-43bf-95ec-d52f4da91371

- **After:**



https://github.com/user-attachments/assets/af1be9d3-9af5-4a30-9b5d-bc4352214a97


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
Heenawter authored Oct 7, 2024
1 parent 5d7de2f commit 10271a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/plugins/dashboard/public/dashboard_listing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React, { Suspense } from 'react';
import { EuiEmptyPrompt, EuiLoadingSpinner } from '@elastic/eui';
import React, { Suspense } from 'react';

import { servicesReady } from '../plugin';
import { untilPluginStartServicesReady } from '../services/kibana_services';
import { DashboardListingProps } from './types';

const ListingTableLoadingIndicator = () => {
Expand All @@ -20,7 +20,7 @@ const ListingTableLoadingIndicator = () => {
const LazyDashboardListing = React.lazy(() =>
(async () => {
const modulePromise = import('./dashboard_listing_table');
const [module] = await Promise.all([modulePromise, servicesReady]);
const [module] = await Promise.all([modulePromise, untilPluginStartServicesReady()]);

return {
default: module.DashboardListingTable,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export interface DashboardStart {
}

export let resolveServicesReady: () => void;
export const servicesReady = new Promise<void>((resolve) => (resolveServicesReady = resolve));

export class DashboardPlugin
implements
Expand Down

0 comments on commit 10271a2

Please sign in to comment.