fix: exclude defaults from hasValues check to avoid overwriting router settings

enable_tag_filtering: false (the default) passed the hasValues guard,
causing every team save to send router_settings even for teams that
never had them configured. This could silently overwrite backend-set
values. Now exclude false and empty arrays from the check.
This commit is contained in:
Yuneng Jiang 2026-04-08 22:15:38 -07:00
parent ce6973109a
commit 4ba9219e1d
No known key found for this signature in database

View file

@ -591,11 +591,18 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
updateData.access_group_ids = values.access_group_ids;
}
// Handle router_settings - read fresh values from DOM at save time
// Handle router_settings - read fresh values from DOM at save time.
// Only include if the user actually configured something meaningful
// (exclude defaults like enable_tag_filtering: false and empty arrays).
const currentRouterSettings = routerSettingsRef.current?.getValue();
if (currentRouterSettings?.router_settings) {
const hasValues = Object.values(currentRouterSettings.router_settings).some(
(value) => value !== null && value !== undefined && value !== "",
(value) =>
value !== null &&
value !== undefined &&
value !== "" &&
value !== false &&
!(Array.isArray(value) && value.length === 0),
);
if (hasValues) {
updateData.router_settings = currentRouterSettings.router_settings;