[Fix]: delete formula issue (#4526)

This commit is contained in:
Rajat Dabade 2024-02-12 21:42:56 +05:30 committed by GitHub
parent 3a20862d0c
commit 6bc5ceac3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 6 deletions

View File

@ -151,6 +151,7 @@ export function Formula({
onToggleVisibility={handleToggleDisableFormula}
onDelete={handleDelete}
onCollapseEntity={handleToggleCollapseFormula}
showDeleteButton
/>
{!isCollapse && (

View File

@ -2,7 +2,6 @@ import './QBEntityOptions.styles.scss';
import { Button, Col } from 'antd';
import cx from 'classnames';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { ChevronDown, ChevronRight, Eye, EyeOff, Trash2 } from 'lucide-react';
interface QBEntityOptionsProps {
@ -12,6 +11,7 @@ interface QBEntityOptionsProps {
onDelete: () => void;
onToggleVisibility: () => void;
onCollapseEntity: () => void;
showDeleteButton: boolean;
}
export default function QBEntityOptions({
@ -21,11 +21,8 @@ export default function QBEntityOptions({
onDelete,
onToggleVisibility,
onCollapseEntity,
showDeleteButton,
}: QBEntityOptionsProps): JSX.Element {
const { currentQuery } = useQueryBuilder();
const showDeleteButton = currentQuery.builder.queryData.length > 1;
return (
<Col span={24}>
<div className="qb-entity-options">

View File

@ -47,7 +47,7 @@ export const Query = memo(function Query({
filterConfigs,
queryComponents,
}: QueryProps): JSX.Element {
const { panelType } = useQueryBuilder();
const { panelType, currentQuery } = useQueryBuilder();
const { pathname } = useLocation();
const [isCollapse, setIsCollapsed] = useState(false);
@ -288,6 +288,7 @@ export const Query = memo(function Query({
onToggleVisibility={handleToggleDisableQuery}
onDelete={handleDeleteQuery}
onCollapseEntity={handleToggleCollapsQuery}
showDeleteButton={currentQuery.builder.queryData.length > 1}
/>
{!isCollapse && (