Skip to content

Commit

Permalink
Merge pull request #19614 from Marklb/marklb/undo-over-removal-of-dep…
Browse files Browse the repository at this point in the history
…recation

Undo template gen removal during deprecation property removal
  • Loading branch information
ndelangen authored Nov 4, 2022
2 parents afc8d39 + 78cded6 commit d99735b
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { storyPropsProvider } from './StorybookProvider';
import { isComponentAlreadyDeclaredInModules } from './utils/NgModulesAnalyzer';
import { isDeclarable, isStandaloneComponent } from './utils/NgComponentAnalyzer';
import { createStorybookWrapperComponent } from './StorybookWrapperComponent';
import { computesTemplateFromComponent } from './ComputesTemplateFromComponent';

export const getStorybookModuleMetadata = (
{
Expand All @@ -21,7 +22,12 @@ export const getStorybookModuleMetadata = (
storyProps$: Subject<ICollection>
): NgModule => {
const { props, styles, moduleMetadata = {} } = storyFnAngular;
const { template } = storyFnAngular;
let { template } = storyFnAngular;

const hasTemplate = !hasNoTemplate(template);
if (!hasTemplate && component) {
template = computesTemplateFromComponent(component, props, '');
}

/**
* Create a component that wraps generated template and gives it props
Expand Down Expand Up @@ -68,3 +74,7 @@ export const createStorybookModule = (ngModule: NgModule): Type<unknown> => {
class StorybookModule {}
return StorybookModule;
};

function hasNoTemplate(template: string | null | undefined): template is undefined {
return template === null || template === undefined;
}

0 comments on commit d99735b

Please sign in to comment.