Skip to content

Commit

Permalink
fix: move define ComponentClass into if block
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Apr 1, 2022
1 parent 2ca6c32 commit e7f1fd6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion src/compilers/renderer-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export class RendererCompiler {
body.push(new ImportHelper('SanSSRData'))

if (this.options.useProvidedComponentClass) {
body.push(DEF('ComponentClass', BINARY(I('info'), '.', I('ComponentClass'))))
body.push(STATEMENT(new CreateComponentPrototype(info)))
}

Expand Down
1 change: 1 addition & 0 deletions src/target-js/js-emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class JSEmitter extends Emitter {
case SyntaxKind.CreateComponentPrototype:
this.write(`if (!sanSSRResolver.getPrototype("${node.info.id}")) {`)
this.indent()
this.nextLine('let ComponentClass = info.ComponentClass')
this.nextLine('if (typeof ComponentClass === \'function\') {')
this.indent()
this.nextLine(`sanSSRResolver.setPrototype("${node.info.id}", _.createInstanceFromClass(ComponentClass));`)
Expand Down

0 comments on commit e7f1fd6

Please sign in to comment.