[Canvas] Fix by-reference embeddable migration error during workpad migration (#133911) (#134146)

* Adds check in embeddable fn migration to migrate only by value embedables

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 346840b032)
This commit is contained in:
Catherine Liu 2022-06-09 18:02:53 -07:00 committed by GitHub
parent ca10ce05bf
commit b290b13cbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,10 +62,12 @@ export function embeddableFunctionFactory({
const embeddableInput = decode(state.arguments.config[0] as string);
const embeddableType = state.arguments.type[0];
const migratedInput = migrateFn({ ...embeddableInput, type: embeddableType });
state.arguments.config[0] = encode(migratedInput);
state.arguments.type[0] = migratedInput.type as string;
if (embeddableInput.explicitInput.attributes || embeddableInput.explicitInput.savedVis) {
const migratedInput = migrateFn({ ...embeddableInput, type: embeddableType });
state.arguments.config[0] = encode(migratedInput);
state.arguments.type[0] = migratedInput.type as string;
}
return state;
};