Skip to content

Fix the Statistics dialog clearing columns as soon as one is selected. #2018 - #10691

Open
kundansable wants to merge 2 commits into
pgadmin-org:masterfrom
kundansable:fix/statistics-column-picker
Open

kundansable wants to merge 2 commits into
pgadmin-org:masterfrom
kundansable:fix/statistics-column-picker

Conversation

@kundansable

@kundansable kundansable commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In the Statistics Create dialog, selecting a column immediately cleared the selection, so columns could not be chosen.

Cause

The columns field's depChange also fires on the field's own changes, so every selection reset columns to [].

Fix

Reset the columns only when the schema or table field changes.

Testing

Manually in the UI: picked table t, selected columns a and b; both stayed selected and Save became enabled.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Changing the selected columns no longer clears the selection unexpectedly.
    • Changing the schema or table still clears the column selection to reflect the updated context.

…pgadmin-org#2018

The columns field's depChange also fires on the field's own changes, so
selecting a column reset the selection. Clear it only when the schema or
table changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 93217e9 and 9b57399.

Files selected for processing: 1
  • web/regression/javascript/schema_ui_files/statistics.ui.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

The columns dependency-change handler now clears the selection only when the change source is schema or table. A regression test covers changes to columns, schema, and table.

Changes

Statistics column selection

Layer / File(s) Summary
Conditional column selection clearing
web/pgadmin/browser/server_groups/servers/databases/schemas/statistics/static/js/statistics.ui.js, web/regression/javascript/schema_ui_files/statistics.ui.spec.js
The handler clears columns only when the change source is schema or table. The regression test checks that changing columns itself does not clear its value and that schema or table changes clear it.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: asheshv

Merge Risk: Minimal · up to 9b573

The Statistics column-selection fix is covered by the regression test and is mergeable.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: preventing the Statistics dialog from clearing the columns selection when a column is selected. The issue reference is acceptable.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrow guard addresses the selection bug while preserving context resets; the optional regression-test suggestion is non-blocking.

1 open issue
What changed in this PR

Fixes column selection in the Statistics Create dialog by limiting selection resets to changes in the table context.

Changes:

  • Preserves selected columns when the columns field changes.
  • Continues clearing columns when the schema or table changes.
  • Adds comments explaining why the callback ignores its own field changes.
File Description
web/​pgadmin/​browser/​server_groups/​servers/​databases/​schemas/​statistics/​static/​js/​statistics.ui.js Guards the column-reset callback by the changed field.

Review effort: Balanced

…rg#2018

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants