mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Fix customization not found (#2734)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'gitbook': patch
|
||||
---
|
||||
|
||||
Fix errors from customization not found
|
||||
@@ -850,9 +850,21 @@ export async function getSiteData(
|
||||
const spaces =
|
||||
siteSpaces ?? (sections ? parseSpacesFromSiteSpaces(sections.section.siteSpaces) : []);
|
||||
|
||||
const customization = await getActiveCustomizationSettings(
|
||||
pointer.siteSpaceId ? customizations.siteSpaces[pointer.siteSpaceId] : customizations.site,
|
||||
);
|
||||
const settings = (() => {
|
||||
if (pointer.siteSpaceId) {
|
||||
const siteSpaceSettings = customizations.siteSpaces[pointer.siteSpaceId];
|
||||
if (siteSpaceSettings) {
|
||||
return siteSpaceSettings;
|
||||
}
|
||||
// We got the pointer from an API and customizations from another.
|
||||
// It's possible that the two are unsynced leading to not found customizations for the space.
|
||||
// It's better to fallback on customization of the site that displaying an error.
|
||||
console.warn('Customization not found for site space', pointer.siteSpaceId);
|
||||
}
|
||||
return customizations.site;
|
||||
})();
|
||||
|
||||
const customization = await getActiveCustomizationSettings(settings);
|
||||
|
||||
return {
|
||||
customization,
|
||||
|
||||
Reference in New Issue
Block a user