From cac275a220331149eb42ec0d18f7404e21b9a0a6 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:06:17 -0500 Subject: [PATCH] Normalize root comment keys before rendering --- js/ui/components/VideoModal.js | 7 ++++++- js/ui/videoModalCommentController.js | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/js/ui/components/VideoModal.js b/js/ui/components/VideoModal.js index abdd0e41..f9675296 100644 --- a/js/ui/components/VideoModal.js +++ b/js/ui/components/VideoModal.js @@ -1815,7 +1815,12 @@ export class VideoModal { } if (typeof value === "string") { const trimmed = value.trim(); - if (!trimmed || trimmed === "null" || trimmed === "undefined") { + if ( + !trimmed || + trimmed === "null" || + trimmed === "undefined" || + trimmed === "__root__" + ) { return null; } return trimmed; diff --git a/js/ui/videoModalCommentController.js b/js/ui/videoModalCommentController.js index a021a3ab..5d7f11d3 100644 --- a/js/ui/videoModalCommentController.js +++ b/js/ui/videoModalCommentController.js @@ -458,8 +458,24 @@ export default class VideoModalCommentController { input instanceof Map ? input : this.createMapFromInput(input); const result = new Map(); source.forEach((value, key) => { + let normalizedKey = key; + if (normalizedKey === null || normalizedKey === undefined) { + normalizedKey = null; + } else if (typeof normalizedKey === "string") { + const trimmed = normalizedKey.trim(); + if ( + !trimmed || + trimmed === "null" || + trimmed === "undefined" || + trimmed === "__root__" + ) { + normalizedKey = null; + } else { + normalizedKey = trimmed; + } + } const list = Array.isArray(value) ? value.filter(Boolean) : []; - result.set(key, list); + result.set(normalizedKey, list); }); return result; }