mirror of
https://github.com/apache/superset.git
synced 2026-06-01 21:59:26 +00:00
fix: Fix auto-reversion of label/title in the Metrics popover (#19889)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import React, { ReactNode, useMemo } from 'react';
|
||||
import { useDrop } from 'react-dnd';
|
||||
import { t, useTheme } from '@superset-ui/core';
|
||||
import ControlHeader from 'src/explore/components/ControlHeader';
|
||||
@@ -48,6 +48,7 @@ export type DndSelectLabelProps = {
|
||||
export default function DndSelectLabel({
|
||||
displayGhostButton = true,
|
||||
accept,
|
||||
valuesRenderer,
|
||||
...props
|
||||
}: DndSelectLabelProps) {
|
||||
const theme = useTheme();
|
||||
@@ -70,6 +71,8 @@ export default function DndSelectLabel({
|
||||
}),
|
||||
});
|
||||
|
||||
const values = useMemo(() => valuesRenderer(), [valuesRenderer]);
|
||||
|
||||
function renderGhostButton() {
|
||||
return (
|
||||
<AddControlLabel
|
||||
@@ -92,7 +95,7 @@ export default function DndSelectLabel({
|
||||
canDrop={canDrop}
|
||||
isOver={isOver}
|
||||
>
|
||||
{props.valuesRenderer()}
|
||||
{values}
|
||||
{displayGhostButton && renderGhostButton()}
|
||||
</DndLabelsContainer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user