From 1717a2836cb5135aab5de25cabb4b28405f299d1 Mon Sep 17 00:00:00 2001 From: celikerde Date: Tue, 12 May 2026 18:16:11 +0300 Subject: [PATCH] fix(useTableNames): prevent mutation of title interpolation props - Refactored the interpolation logic to build a fresh object instead of mutating props.form{Edit,Create}TitleInterpolations. - Ensured that the original paths are preserved to avoid issues with subsequent computations. --- vue/src/js/hooks/table/useTableNames.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/vue/src/js/hooks/table/useTableNames.js b/vue/src/js/hooks/table/useTableNames.js index 500f8114b..286fe4d91 100644 --- a/vue/src/js/hooks/table/useTableNames.js +++ b/vue/src/js/hooks/table/useTableNames.js @@ -117,15 +117,21 @@ export default function useTableNames(props, context) { translationKey = props.editFormTitle } - let interpolation = isEditing ? props.formEditTitleInterpolations : props.formCreateTitleInterpolations - - for(let key in interpolation) { - let value = interpolation[key] - interpolation[key] = __isset(Module[interpolation[key]]) - ? Module[interpolation[key]].value - : __isset(editedItem.value[interpolation[key]]) - ? editedItem.value[interpolation[key]] - : value + // NOTE: Build a fresh object — never mutate `props.form{Edit,Create}TitleInterpolations`. + // The source map holds *paths* (e.g. `{ item: 'id' }`); writing the resolved value back into + // it would poison the next compute, since the loop would then look up the resolved value + // itself (e.g. a UUID) instead of the original path — pinning the modal title to the id of + // the first ticket opened in the session. + const interpolationSource = isEditing ? props.formEditTitleInterpolations : props.formCreateTitleInterpolations + const interpolation = {} + + for(let key in interpolationSource) { + const path = interpolationSource[key] + interpolation[key] = __isset(Module[path]) + ? Module[path].value + : __isset(editedItem.value[path]) + ? editedItem.value[path] + : path } return te(translationKey) ? t(translationKey, interpolation) : translationKey