Skip to content

Commit

Permalink
[Lens] Fix missing embeddable panel titles (#203355)
Browse files Browse the repository at this point in the history
## Summary

When using the new Custom Lens embeddable component, the titles are
hidden by default due to to a regression introduced in
#186642.
This PR should fix the correct title handling of the header visibility
by hiding or showing the wrapping Panel title depending on the
`hidePanelTitles` props of the `LensRenderer` component


fix #203354
  • Loading branch information
markov00 authored Dec 10, 2024
1 parent 101e797 commit 6e57a23
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function LensRenderer({
filters,
timeRange,
disabledActions,
hidePanelTitles,
...props
}: LensRendererProps) {
// Use the settings interface to store panel settings
Expand All @@ -71,6 +72,7 @@ export function LensRenderer({
}, []);
const disabledActionIds$ = useObservableVariable(disabledActions);
const viewMode$ = useObservableVariable(viewMode);
const hidePanelTitles$ = useObservableVariable(hidePanelTitles);

// Lens API will be set once, but when set trigger a reflow to adopt the latest attributes
const [lensApi, setLensApi] = useState<LensApi | undefined>(undefined);
Expand Down Expand Up @@ -112,7 +114,6 @@ export function LensRenderer({
const panelProps: PanelProps = useMemo(() => {
return {
hideInspector: !showInspector,
hideHeader: showPanelChrome,
showNotifications: false,
showShadow: false,
showBadges: false,
Expand All @@ -124,7 +125,7 @@ export function LensRenderer({
return (extraActions ?? []).concat(actions || []);
},
};
}, [showInspector, showPanelChrome, withDefaultActions, extraActions, lensApi]);
}, [showInspector, withDefaultActions, extraActions, lensApi]);

return (
<ReactEmbeddableRenderer<LensSerializedState, LensRuntimeState, LensApi>
Expand All @@ -147,6 +148,7 @@ export function LensRenderer({
...initialStateRef.current,
attributes: props.attributes,
}),
hidePanelTitle: hidePanelTitles$,
})}
onApiAvailable={setLensApi}
hidePanelChrome={!showPanelChrome}
Expand Down

0 comments on commit 6e57a23

Please sign in to comment.