Skip to content

Commit

Permalink
Fix canvas rendering bug
Browse files Browse the repository at this point in the history
Signed-off-by: Willie Hung <[email protected]>
  • Loading branch information
willie-hung committed Nov 30, 2023
1 parent 41dc3aa commit 05855cb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ interface CardFormProps {
card: Card;
updateCard: (index: number, card: Card) => void;
options: any;
activeVisName: string;
handleVisTypeChange: () => void;
valueOfSelected: string;
onChange: () => void;
}

const CardForm = ({
Expand All @@ -35,7 +35,7 @@ const CardForm = ({
}: CardFormProps) => {
return (
<EuiAccordion
id={index}
id={String(index)}
buttonContent={`Drilldown ${index + 1}`}
paddingSize="s"
initialIsOpen={true}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_drilldown/public/drilldown_fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const createDrilldownVisFn = (): DrilldownVisExpressionFunctionDefinition
}),
args: {
cards: {
types: [],
types: ['string'],
help: i18n.translate('visTypeDrilldown.function.cards.help', {
defaultMessage: 'Cards',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import { EuiCard, EuiFlexItem, EuiIcon } from '@elastic/eui';
import { DrilldownVisParams, Card } from './types';

interface DrilldownVisComponentProps extends DrilldownVisParams {
cards: Card[];
renderComplete: () => void;
}

const DrilldownVisComponent = ({ cards, renderComplete }: DrilldownVisComponentProps) => {
useEffect(renderComplete); // renderComplete will be called after each render to signal, that we are done with rendering.

const parsedCardData = JSON.parse(cards);

return (
<>
{cards &&
cards.map((card, index) => (
{parsedCardData &&
parsedCardData.map((card: Card, index: number) => (
<EuiFlexItem key={index}>
<EuiCard
icon={<EuiIcon size="xl" type="dashboardApp" />}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_drilldown/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const toExpressionAst = (vis: Vis) => {
const drilldownVis = buildExpressionFunction<DrilldownVisExpressionFunctionDefinition>(
'drilldownVis',
{
cards,
cards: JSON.stringify(cards),
}
);

Expand Down

0 comments on commit 05855cb

Please sign in to comment.