mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[embeddable] update DefaultPresentationPanelApi to define parentApi as unknown (#218668)
DefaultPresentationPanelApi should define parentApi as unknown. `ReactEmbeddableRenderer` renders panels with `PresentationPanel`. `PresentationPanel` takes `api: DefaultPresentationPanelApi` as a prop and `DefaultPresentationPanelApi` should not define ParentApi type more precisely then its defined in `ReactEmbeddableRenderer`. `ReactEmbeddableRenderer` defines parent as `ParentApi extends HasSerializedChildState<SerializedState> = HasSerializedChildState<SerializedState>`. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
60af3ff3d5
commit
678b53a1a7
8 changed files with 16 additions and 24 deletions
|
@ -29,7 +29,7 @@ import {
|
|||
useBatchedPublishingSubjects,
|
||||
} from '@kbn/presentation-publishing';
|
||||
import React from 'react';
|
||||
import { PresentationContainer } from '@kbn/presentation-containers';
|
||||
import { PresentationContainer, apiIsPresentationContainer } from '@kbn/presentation-containers';
|
||||
import { serializeBookAttributes, stateManagerFromAttributes } from './book_state';
|
||||
import { SAVED_BOOK_ID } from './constants';
|
||||
import { openSavedBookEditor } from './saved_book_editor';
|
||||
|
@ -116,8 +116,11 @@ export const getSavedBookEmbeddableFactory = (core: CoreStart) => {
|
|||
const nextIsByReference = Boolean(result.savedBookId);
|
||||
|
||||
// if the by reference state has changed during this edit, reinitialize the panel.
|
||||
if (nextIsByReference !== isByReference) {
|
||||
api.parentApi?.replacePanel<BookSerializedState>(api.uuid, {
|
||||
if (
|
||||
nextIsByReference !== isByReference &&
|
||||
apiIsPresentationContainer(api.parentApi)
|
||||
) {
|
||||
api.parentApi.replacePanel<BookSerializedState>(api.uuid, {
|
||||
serializedState: serializeBook(nextIsByReference, result.savedBookId),
|
||||
panelType: api.type,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue