mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Lens][Embeddable] Use reload$ api for custom component (#203755)
## Summary Fixes #203457 Use the `lastReloadRequestTime` prop to trigger a reload in place of the legacy `searchSessionId` system.
This commit is contained in:
parent
505cc0fbbb
commit
3875d26ae8
1 changed files with 7 additions and 0 deletions
|
@ -61,6 +61,7 @@ export function LensRenderer({
|
|||
disabledActions,
|
||||
searchSessionId,
|
||||
hidePanelTitles,
|
||||
lastReloadRequestTime,
|
||||
...props
|
||||
}: LensRendererProps) {
|
||||
// Use the settings interface to store panel settings
|
||||
|
@ -86,6 +87,11 @@ export function LensRenderer({
|
|||
|
||||
const showPanelChrome = Boolean(withDefaultActions) || (extraActions?.length || 0) > 0;
|
||||
|
||||
const reload$ = useMemo(() => new BehaviorSubject<void>(undefined), []);
|
||||
useEffect(() => {
|
||||
reload$.next();
|
||||
}, [reload$, lastReloadRequestTime]);
|
||||
|
||||
// Re-render on changes
|
||||
// internally the embeddable will evaluate whether it is worth to actual render or not
|
||||
useEffect(() => {
|
||||
|
@ -152,6 +158,7 @@ export function LensRenderer({
|
|||
attributes: props.attributes,
|
||||
}),
|
||||
hidePanelTitle: hidePanelTitles$,
|
||||
reload$, // trigger a reload (replacement for deprepcated searchSessionId)
|
||||
})}
|
||||
onApiAvailable={setLensApi}
|
||||
hidePanelChrome={!showPanelChrome}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue