mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 10:39:32 +01:00
fix(tabs): leave the default-group options alone when the groups did not change
Merge-time fix for #676 (review nit 6). Once a Case settings popover had been opened, every adopted tab layout (each create, delete and reorder) replaced both selects' options, even with the popover hidden and the group list unchanged, so a session created elsewhere could reset a native dropdown the user had open. _refreshCaseDefaultGroupOptions now returns early when the ids and names are the same. A vm case pins it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a3efc9b963
commit
9b8cb82c3b
3 files changed
+30
-3
No files matched your search
@@ -3429,12 +3429,18 @@ Object.assign(CodemanApp.prototype, {
|
||||
/**
|
||||
* The tab layout changed (a group was created, renamed or deleted): redraw the
|
||||
* options from it. A deleted selection shows as Ungrouped, which is where the
|
||||
* server now places new sessions (it forgets the stale ID on its next read).
|
||||
* server now places new sessions (it forgets the stale ID at the next creation).
|
||||
* Every create, delete and reorder broadcasts a layout, so an unchanged group
|
||||
* list is left alone: rebuilding it would reset a dropdown the user has open.
|
||||
*/
|
||||
_refreshCaseDefaultGroupOptions(layout) {
|
||||
const state = this._caseDefaultGroupState;
|
||||
if (!state || !layout || !Array.isArray(layout.groups)) return;
|
||||
state.groups = layout.groups.map((group) => ({ id: group.id, name: group.name }));
|
||||
const groups = layout.groups.map((group) => ({ id: group.id, name: group.name }));
|
||||
const unchanged = groups.length === state.groups.length
|
||||
&& groups.every((group, i) => group.id === state.groups[i].id && group.name === state.groups[i].name);
|
||||
if (unchanged) return;
|
||||
state.groups = groups;
|
||||
const value = this._renderCaseDefaultGroupSelects(state.groups, state.groupId);
|
||||
if (!value) state.groupId = null;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user