Skip to content

fix: prevent custom columns from resetting to defaults when saving preset or renaming column#6537

Open
ausias-armesto wants to merge 1 commit into
keephq:mainfrom
ausias-armesto:fix/column-configuration
Open

fix: prevent custom columns from resetting to defaults when saving preset or renaming column#6537
ausias-armesto wants to merge 1 commit into
keephq:mainfrom
ausias-armesto:fix/column-configuration

Conversation

@ausias-armesto
Copy link
Copy Markdown

@ausias-armesto ausias-armesto commented May 27, 2026

Problem

close #5657
Users on custom (non-static) presets would see their column layout silently reset to the default columns in two scenarios:

Bug 1: Renaming a column or changing its format wiped all other column config

updateMultipleColumnConfigs built a partial object containing only the fields passed in the call (e.g. just column_rename_mapping). The backend PUT /preset/{id}/column-config treats the body as a full replacement, so sending only one field erased column_visibility, column_order, and every other field. Any column the user had added that wasn't in the default set would then disappear.

Fix:
updateMultipleColumnConfigs now always sends the full current config to the backend, using the incoming updates to override only the changed fields (?? operator). This ensures a rename, format change, or visibility toggle never erases unrelated config fields.

Bug 2: Saving the preset itself reset the column layout

mutatePresetsList called revalidateMultiple(["/preset", "/preset?"]) using the default prefix matching (key.startsWith(k)). This accidentally matched /preset/{id}/column-config in the SWR cache, triggering a re-fetch and discarding the cached column config. Since the column config is stored and fetched separately from the preset list, it should never be invalidated by a preset save.

Fix:
usePresetActions — mutatePresetsList now uses isExact: true for the /preset key and prefix matching only for /preset? (query-string variants). This correctly invalidates the preset list without touching /preset/{id}/column-config.

usePresetColumnConfig — Removed the redundant revalidateMultiple(["/preset", "/preset?"]) call after saving column config. The hook's own mutate() already revalidates /preset/{presetId}/column-config; the extra call was unnecessary and subject to the same prefix-matching collateral damage.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Something isn't working labels May 27, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 27, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 27, 2026
@shahargl shahargl enabled auto-merge (squash) May 27, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Save layout configuration

3 participants