refactor: disable automatic slug regeneration on field and section name updates to ensure stable references

This commit is contained in:
pradeepkumar
2026-04-15 16:33:08 +05:30
parent 29447de5b2
commit 416257a881
2 changed files with 5 additions and 23 deletions

View File

@@ -108,13 +108,9 @@ export class ProfileSectionsService {
const data: any = { ...updateSectionDto };
// Resolve effective slug: explicit slug from DTO wins; otherwise regenerate from name if name changed
let effectiveSlug: string | undefined;
if (updateSectionDto.slug) {
effectiveSlug = updateSectionDto.slug;
} else if (updateSectionDto.name) {
effectiveSlug = this.generateSlug(updateSectionDto.name);
}
// Slug only changes when admin explicitly sends one — renaming the section never
// regenerates it, so field/section references stay stable.
const effectiveSlug: string | undefined = updateSectionDto.slug;
if (effectiveSlug) {
// Check if slug conflicts with another section