Skip to content

Commit 50974fa

Browse files
committed
fix: Prevent root level page from overwriting home page ID
Critical bug: When processing root-level pages (sectionName === null), the first page's ID was overwriting the home page ID in syncedPages map. This caused all subsequent sections to use the wrong parent. Example bug: - First root page 'Solution Draft' (id=101) overwrote home (id=100) - 'Subscriptions' section then used 101 as parent instead of 100 - Result: Subscriptions appeared under Solution Draft instead of Home Fix: Only update syncedPages map for actual sections (sectionName !== null), never for root level which should always remain the home page ID. All tests passing (148/148).
1 parent f479e9e commit 50974fa

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/confluence-syncer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ async function syncPages(home, localPages, sectionHierarchy, renderer) {
171171

172172
// The first page in this section represents the section
173173
// Store its ID so child sections can reference it
174-
if (i === 0 && syncedPage && syncedPage.id) {
174+
// Don't overwrite the root level (null) which is set to home page ID
175+
if (i === 0 && sectionName !== null && syncedPage && syncedPage.id) {
175176
syncedPages.set(sectionName, syncedPage.id);
176177
}
177178
}

0 commit comments

Comments
 (0)