Skip to content

Commit

Permalink
🐛 Fix first rendering ghost issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Mar 31, 2023
1 parent 39ca589 commit e8c4e5f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('application-level user messages', () => {
activeDatasource: {
checkIntegrity: jest.fn(() => ['missing_pattern']),
} as unknown as Datasource,
activeDatasourceState: { state: {} },
activeDatasourceState: { isLoading: false, state: {} },
core: createCoreStartWithPermissions(),
...irrelevantProps,
})
Expand All @@ -166,7 +166,7 @@ describe('application-level user messages', () => {
activeDatasource: {
checkIntegrity: jest.fn(() => ['missing_pattern']),
} as unknown as Datasource,
activeDatasourceState: { state: {} },
activeDatasourceState: { isLoading: false, state: {} },
// user can go to management, but indexPatterns management is not accessible
core: createCoreStartWithPermissions({
navLinks: { management: true },
Expand All @@ -188,7 +188,7 @@ describe('application-level user messages', () => {
activeDatasource: {
checkIntegrity: jest.fn(() => ['missing_pattern']),
} as unknown as Datasource,
activeDatasourceState: { state: {} },
activeDatasourceState: { isLoading: false, state: {} },
// user can't go to management at all
core: createCoreStartWithPermissions({
navLinks: { management: false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getApplicationUserMessages = ({
visualization: VisualizationState | undefined;
visualizationMap: VisualizationMap;
activeDatasource: Datasource | null | undefined;
activeDatasourceState: { state: unknown } | null;
activeDatasourceState: { isLoading: boolean; state: unknown } | null;
dataViews: DataViewsState;
core: CoreStart;
}): UserMessage[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,14 @@ export async function persistedStateToExpression(

export function getMissingIndexPattern(
currentDatasource: Datasource | null | undefined,
currentDatasourceState: { state: unknown } | null,
currentDatasourceState: { isLoading: boolean; state: unknown } | null,
indexPatterns: IndexPatternMap
) {
if (currentDatasourceState?.state == null || currentDatasource == null) {
if (
currentDatasourceState?.isLoading ||
currentDatasourceState?.state == null ||
currentDatasource == null
) {
return [];
}
const missingIds = currentDatasource.checkIntegrity(currentDatasourceState.state, indexPatterns);
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/lens/public/embeddable/embeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ export class Embeddable
},
visualizationMap: this.deps.visualizationMap,
activeDatasource: this.activeDatasource,
activeDatasourceState: { state: this.activeDatasourceState },
activeDatasourceState: {
isLoading: Boolean(this.activeDatasourceState),
state: this.activeDatasourceState,
},
dataViews: {
indexPatterns: this.indexPatterns,
indexPatternRefs: this.indexPatternRefs, // TODO - are these actually used?
Expand Down

0 comments on commit e8c4e5f

Please sign in to comment.