Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fixes show detail button showing in embeds (#69338)

Sébastiend6082bba0803
diff --git a/e2e/test-component/scenarios/embedding-sdk/sdk-question.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/sdk-question.cy.spec.tsx
index da34ffe01af..fbcb59d3df5 100644
--- a/e2e/test-component/scenarios/embedding-sdk/sdk-question.cy.spec.tsx
+++ b/e2e/test-component/scenarios/embedding-sdk/sdk-question.cy.spec.tsx
@@ -68,6 +68,35 @@ describe("scenarios > embedding-sdk > interactive-question", () => {
});
});
+ it("should not show the expand button (metabase#68975)", () => {
+ mountInteractiveQuestion();
+
+ getSdkRoot().within(() => {
+ cy.findByText("Product ID").should("be.visible");
+ cy.findByText("Max of Quantity").should("be.visible");
+
+ cy.findByTestId("viz-settings-button").click();
+
+ H.popover().within(() => {
+ cy.findByText("Show row index").click();
+ });
+
+ // close the popover
+ cy.findByTestId("viz-settings-button").click();
+
+ cy.findByText("#").should("be.visible");
+
+ cy.findByTestId("table-body")
+ .get("[data-index='0']")
+ .within(() => {
+ cy.get("[data-column-id$='_INDEX']")
+ .realHover({ scrollBehavior: false })
+ .findByTestId("detail-shortcut")
+ .should("not.exist");
+ });
+ });
+ });
+
it("should show a watermark in development mode", () => {
cy.intercept("/api/session/properties", (req) => {
req.continue((res) => {
diff --git a/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx b/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
index 22b1aef09e3..f7e32574409 100644
--- a/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
+++ b/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
@@ -658,7 +658,11 @@ export const TableInteractiveInner = forwardRef(function TableInteractiveInner(
}
return {
- variant: shouldShowRowIndex ? "indexExpand" : "expandButton",
+ variant: shouldShowRowIndex
+ ? hasObjectDetail
+ ? "indexExpand"
+ : "index"
+ : "expandButton",
getBackgroundColor,
expandedIndex: zoomedRowIndex,
};