Skip to content

Commit

Permalink
Fix dataview picker glich
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed May 4, 2022
1 parent 10b616a commit 42ae00c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function ChangeDataView({
const { euiTheme } = useEuiTheme();
const [isPopoverOpen, setPopoverIsOpen] = useState(false);
const [dataViewsList, setDataViewsList] = useState<DataViewListItem[]>([]);
const [triggerLabel, setTriggerLabel] = useState('');
const kibana = useKibana<IDataPluginServices>();
const { application, data, storage } = kibana.services;
const styles = ChangeDataViewStyles({ fullWidth: trigger.fullWidth });
Expand Down Expand Up @@ -95,6 +96,12 @@ export function ChangeDataView({
fetchDataViews();
}, [data, currentDataViewId]);

useEffect(() => {
if (trigger.label) {
setTriggerLabel(trigger.label);
}
}, [trigger.label]);

const createTrigger = function () {
const { label, title, 'data-test-subj': dataTestSubj, fullWidth, ...rest } = trigger;
return (
Expand All @@ -113,7 +120,7 @@ export function ChangeDataView({
fullWidth={fullWidth}
{...rest}
>
{label}
{triggerLabel}
</EuiButton>
);
};
Expand Down

0 comments on commit 42ae00c

Please sign in to comment.