Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Clear Kibana index pattern cache on creation or form reset. #62184

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export const useCreateAnalyticsForm = (): CreateAnalyticsFormProps => {

const id = await newIndexPattern.create();

await mlContext.indexPatterns.clearCache();

// id returns false if there's a duplicate index pattern.
if (id === false) {
addRequestMessage({
Expand Down Expand Up @@ -248,6 +250,7 @@ export const useCreateAnalyticsForm = (): CreateAnalyticsFormProps => {
};

const openModal = async () => {
await mlContext.indexPatterns.clearCache();
resetForm();
await prepareFormValidation();
dispatch({ type: ACTION.OPEN_MODAL });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ async function createKibanaIndexPattern(

const id = await emptyPattern.create();

await indexPatterns.clearCache();

// check if there's a default index pattern, if not,
// set the newly created one as the default index pattern.
if (!kibanaConfig.get('defaultIndex')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export const StepCreateForm: FC<Props> = React.memo(

const id = await newIndexPattern.create();

await indexPatterns.clearCache();

// id returns false if there's a duplicate index pattern.
if (id === false) {
toastNotifications.addDanger(
Expand Down