Skip to content

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

Merged
shahargl merged 1 commit into
keephq:mainfrom
ausias-armesto:fix/column-configuration
May 28, 2026
Merged

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

Conversation

@ausias-armesto

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

Copy link
Copy Markdown
Contributor

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

CLAassistant commented May 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@shahargl shahargl left a comment

Copy link
Copy Markdown
Member

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
@shahargl
shahargl disabled auto-merge May 28, 2026 04:06
@shahargl
shahargl merged commit b83d9b1 into keephq:main May 28, 2026
13 of 18 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Fantastic work @ausias-armesto! Your very first PR to keep has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

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