Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
else
{
Layout = "/Areas/Identity/Pages/_Layout.cshtml";
Layout = "/Views/Shared/_Layout.cshtml";
}
}

Expand Down
21 changes: 13 additions & 8 deletions EssentialCSharp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useChatWidget } from "./chat-module.js";
* @prop {TocItem[]} [items]
*/
/** @type {TocItem} */
const tocData = markRaw(TOC_DATA);
const tocData = markRaw(TOC_DATA || []);

//Add new content or features here:

Expand Down Expand Up @@ -80,6 +80,9 @@ const completedFeaturesList = [
* @returns {TocItem[] | undefined} path of items to the current page
* */
function findCurrentPage(path, items) {
if (!items || !Array.isArray(items)) {
return null;
}
for (const item of items) {
const itemPath = [item, ...path];
if (
Expand Down Expand Up @@ -286,8 +289,8 @@ const app = createApp({
const searchQuery = ref('');

const filteredTocData = computed(() => {
if (!searchQuery.value) {
return tocData;
if (!searchQuery.value || !tocData) {
return tocData || [];
}
const query = normalizeString(searchQuery.value);
return tocData.filter(item => filterItem(item, query));
Expand Down Expand Up @@ -318,11 +321,13 @@ const app = createApp({
else {
expandedTocs.clear();
const query = normalizeString(newQuery);
tocData.forEach(item => {
if (filterItem(item, query)) {
expandedTocs.add(item.key);
}
});
if (tocData) {
tocData.forEach(item => {
if (filterItem(item, query)) {
expandedTocs.add(item.key);
}
});
}
}
});

Expand Down