Skip to content

Commit

Permalink
Fix ExternalPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jan 14, 2024
1 parent bf01aa7 commit 11108d9
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions code/ui/blocks/src/blocks/external/ExternalPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@ export class ExternalPreview<TRenderer extends Renderer = Renderer> extends Prev
private moduleExportsByImportPath: Record<Path, ModuleExports> = {};

constructor(public projectAnnotations: ProjectAnnotations<TRenderer>) {
// @ts-expect-error (tom will fix this)
super(new Channel({}));

// @ts-expect-error (tom will fix this)
this.initialize({
getStoryIndex: () => this.storyIndex,
importFn: (path: Path) => {
return Promise.resolve(this.moduleExportsByImportPath[path]);
},
getProjectAnnotations: () =>
composeConfigs([
{ parameters: { docs: { story: { inline: true } } } },
this.projectAnnotations,
]),
});
const importFn = (path: Path) => {
return Promise.resolve(this.moduleExportsByImportPath[path]);
};
const getProjectAnnotations = () =>
composeConfigs<TRenderer>([
{ parameters: { docs: { story: { inline: true } } } },
this.projectAnnotations,
]);
super(importFn, getProjectAnnotations, new Channel({}));
}

async getStoryIndexFromServer() {
return this.storyIndex;
}

processMetaExports = (metaExports: MetaExports) => {
Expand All @@ -59,7 +57,7 @@ export class ExternalPreview<TRenderer extends Renderer = Renderer> extends Prev

const title = metaExports.default.title || this.titles.get(metaExports);

const csfFile = this.storyStore.processCSFFileWithCache<TRenderer>(
const csfFile = this.storyStoreValue.processCSFFileWithCache<TRenderer>(
metaExports,
importPath,
title
Expand All @@ -83,7 +81,7 @@ export class ExternalPreview<TRenderer extends Renderer = Renderer> extends Prev
docsContext = () => {
return new ExternalDocsContext(
this.channel,
this.storyStore,
this.storyStoreValue,
this.renderStoryToElement.bind(this),
this.processMetaExports.bind(this)
);
Expand Down

0 comments on commit 11108d9

Please sign in to comment.