Skip to content

Adrian/add visualize reset button - #122940

Open
adrianviquez wants to merge 3 commits into
masterfrom
adrian/add-visualize-reset-button
Open

Adrian/add visualize reset button#122940
adrianviquez wants to merge 3 commits into
masterfrom
adrian/add-visualize-reset-button

Conversation

@adrianviquez

@adrianviquez adrianviquez commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This PR adds a reset button to the visualize row the same way groupBy added in EXP-802. In short, anytime a chart/equation is added or changed, the reset (trash) button will appear, allowing you to reset said chart/equation. This was the case for 2 or more chart/equations, but this PR added that behavior for the 1st equation if that is changed from its default count value.

Before
Screenshot 2026-08-27 at 3 10 50 PM

After
Screenshot 2026-08-27 at 3 11 22 PM

Addresses EXP-837

@adrianviquez
adrianviquez requested a review from a team as a code owner August 27, 2026 22:11
@adrianviquez

Copy link
Copy Markdown
Contributor Author

@cursor review

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 27, 2026
<Button
variant="transparent"
icon={<IconDelete />}
icon={<IconDelete size="sm" />}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted size to sm to keep consistency w/ the group by one

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b144110. Configure here.

Comment thread static/app/views/explore/toolbar/toolbarVisualize.tsx
Comment on lines 111 to +117
<ToolbarVisualizeHeader />
{editableColumns.map((column, i) => {
const visualize = column.column;
const dragColumnId = editableColumns.length > 1 ? column.id : undefined;
const label = (
<VisualizeLabel
index={i}
visualize={visualize}
onClick={() => toggleVisibility(i)}
/>
);
const onDelete =
editableColumns.length > 1 ? () => deleteColumnAtIndex(i) : undefined;

if (isVisualizeEquation(visualize)) {
return (
<VisualizeEquationInput
key={column.uniqueId}
dragColumnId={dragColumnId}
onDelete={onDelete}
onReplace={newVisualize => replaceOverlay(i, newVisualize)}
const isOnlyVisualize = editableColumns.length === 1;
const canReset = isOnlyVisualize && !isDefaultVisualize(visualize);
const onDelete = isOnlyVisualize
? canReset

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Clicking 'Clear Visualize' on a hidden, non-default chart unintentionally makes it visible again because its visibility state is not preserved.
Severity: LOW

Suggested Fix

When resetting the visualization, preserve its current visibility state. When calling replaceOverlay, pass the visible property from the existing visualize object to the new VisualizeFunction constructor, ensuring a hidden chart remains hidden after being cleared. For example: () => replaceOverlay(i, new VisualizeFunction(DEFAULT_VISUALIZATION, {visible: visualize.visible})).

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/explore/toolbar/toolbarVisualize.tsx#L111-L117

Potential issue: When a single, non-default visualization is hidden, the 'Clear
Visualize' button is displayed. Clicking this button calls `replaceOverlay` with a new
`VisualizeFunction` instance using default parameters. The `VisualizeFunction`
constructor defaults the `visible` property to `true` if it is not explicitly provided.
Consequently, clearing a hidden, non-default chart not only resets it to the default
visualization but also unintentionally makes it visible again, ignoring the user's
previous action to hide it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is okay, makes sense to me

@adrianviquez

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1313040. Configure here.

@nsdeschenes nsdeschenes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants