@salesforcedevs/docs-components
Advanced tools
Comparing version
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.17.0", | ||
"version": "1.17.2", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -28,3 +28,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "1ffac16d66295e04f390e3240328e7f7a9541268" | ||
"gitHead": "456b8ad8b3162df223f9809e66a454cb66b4add0" | ||
} |
@@ -14,3 +14,4 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
PageReference, | ||
TocMap | ||
TocMap, | ||
ContentData | ||
} from "./types"; | ||
@@ -76,3 +77,4 @@ import { SearchSyncer } from "docUtils/searchSyncer"; | ||
private language?: DocLanguage | null = null; | ||
private loaded = false; | ||
private displayContent = false; | ||
private display404 = false; | ||
private _pageHeader?: Header; | ||
@@ -190,3 +192,9 @@ private pdfUrl = ""; | ||
); | ||
this.fetchDocument().then(() => (this.loaded = true)); | ||
this.fetchDocument().then((content: any) => { | ||
if (content) { | ||
this.displayContent = true; | ||
} else { | ||
this.display404 = true; | ||
} | ||
}); | ||
window.addEventListener("popstate", this.handlePopState); | ||
@@ -469,3 +477,3 @@ | ||
async fetchDocument(): Promise<void> { | ||
async fetchDocument(): Promise<string> { | ||
this.setState({ | ||
@@ -484,3 +492,3 @@ isFetchingDocument: true | ||
}); | ||
return; | ||
return ""; | ||
} | ||
@@ -517,7 +525,7 @@ | ||
try { | ||
await this.fetchContent(); | ||
const moreData = await this.fetchContent(); | ||
this.setState({ | ||
isFetchingDocument: false | ||
}); | ||
return; | ||
return moreData.content; | ||
} catch (error) { | ||
@@ -536,5 +544,6 @@ this.pageReference.contentDocumentId = `${data.id}.htm`; | ||
}); | ||
return data.content; | ||
} | ||
async fetchContent(): Promise<void> { | ||
async fetchContent(): Promise<ContentData> { | ||
this.setState({ | ||
@@ -563,2 +572,3 @@ isFetchingContent: true | ||
}); | ||
return data; | ||
} | ||
@@ -565,0 +575,0 @@ |
Sorry, the diff of this file is not supported yet
282698
0.22%6989
0.14%