Skip to content
Merged
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
12 changes: 8 additions & 4 deletions website/modules/snackPlayerInitializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ export default (() => {
}
});

observer.observe(document.querySelector('.container'), {
childList: true,
subtree: true,
});
// Homepage or Showcase pages does not use MDX content, so `.container` node is not present there
const mdxContentContainer = document.body.querySelector('.container');
if (mdxContentContainer) {
observer.observe(mdxContentContainer, {
childList: true,
subtree: true,
});
}
};

// Need to set the theme before the snack script (deferred) initialize
Expand Down