mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-29 13:48:35 +07:00
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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user