Skip to content

Commit

Permalink
fix: Don't search shared topics twice for game "shared"
Browse files Browse the repository at this point in the history
  • Loading branch information
ozxybox committed Dec 20, 2023
1 parent 14ae7c5 commit 057f5d8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/exporter/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class PageHandler {
renderer: Renderer;

menu: Menu;
articleCache: { [path: string]: { [article: string]: RenderedPage } };
articleCache: { [topicPath: string]: { [article: string]: RenderedPage } };
gameArticles: { [game: string]: Article[] };

constructor() {
Expand Down Expand Up @@ -104,8 +104,10 @@ export class PageHandler {
// Array of tuples of [article, page]
const articles: [string, RenderedPage][] = [];

// Search all possible paths for articles and build a list of every article we want
const possiblePaths = [`${game.id}/${topic.path}`, `shared/${topic.path}`];
// Search the game's topics and shared's topics for articles
// Build a list of every article we want
const possiblePaths = [`${game.id}/${topic.path}`];
if (game.id !== 'shared') possiblePaths.push(`shared/${topic.path}`);
for (const path of possiblePaths) {
// Skip topics not in the cache
if (!(path in this.articleCache)) {
Expand Down

0 comments on commit 057f5d8

Please sign in to comment.