From 1fffc63b4331bc2ca397a30ed038e68ddcaf3fd5 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 30 Oct 2025 02:44:29 -0700 Subject: [PATCH] fix: prevent null entries during nested group navigation Moved padding logic inside group check to only pad when navigating through groups. This prevents creating null placeholders for file positions that aren't groups. Fixes issue where docs.json had null entries when adding files to nested groups. --- tools/translate/sync_and_translate.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/translate/sync_and_translate.py b/tools/translate/sync_and_translate.py index 6928665b..807ce825 100644 --- a/tools/translate/sync_and_translate.py +++ b/tools/translate/sync_and_translate.py @@ -596,12 +596,11 @@ class DocsSynchronizer: if idx < len(en_pages): en_item = en_pages[idx] - # Ensure target has items up to this index - while len(current_target["pages"]) <= idx: - current_target["pages"].append(None) - # If English item is a group, ensure target has matching group if isinstance(en_item, dict) and "pages" in en_item: + # Ensure target has items up to this index (only for groups we'll navigate through) + while len(current_target["pages"]) <= idx: + current_target["pages"].append(None) target_item = current_target["pages"][idx] if not isinstance(target_item, dict) or "pages" not in target_item: