Skip to content

Commit

Permalink
poc for top-level instance stabillity
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Jun 29, 2024
1 parent 4b7d545 commit e50cbd4
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ export default class OutletHelper extends Component {
return render.model;
}
}
const tplComponentInstance = new tpl(args);
if (tpl.instance) {
return tpl.instance.template;
}
render.controller['args'] = args;
const tplComponentInstance = new tpl(args);
tplComponentInstance.template = tplComponentInstance.template.bind(render.controller);
// we need to provide stable refs here to avoid re-renders
return tplComponentInstance.template.bind(render.controller);
tpl.instance = tplComponentInstance;
return tplComponentInstance.template;
}
get model() {
const state = this.state;
Expand Down

0 comments on commit e50cbd4

Please sign in to comment.