-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Fix custom-element render issue with overlaying variable instances
- Loading branch information
Showing
3 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ const Variables = Fn.inherits('Hawkejs.Base', function Variables(renderer, varia | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 2.0.0 | ||
* @version 2.0.0 | ||
* @version 2.3.16 | ||
* | ||
* @param {Mixed} value | ||
* @param {Renderer} renderer | ||
|
@@ -33,6 +33,10 @@ const Variables = Fn.inherits('Hawkejs.Base', function Variables(renderer, varia | |
*/ | ||
Variables.setStatic(function cast(value, renderer) { | ||
|
||
if (!renderer) { | ||
throw new Error('Unable to cast to Variables without renderer instance'); | ||
} | ||
|
||
if (!value || typeof value != 'object') { | ||
return new Variables(renderer); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -951,16 +951,17 @@ function addTemplateRenderer(element_class) { | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 2.0.0 | ||
* @version 2.3.15 | ||
* @version 2.3.16 | ||
* | ||
* @param {Boolean} re_render Is this a render done from outside a normal render? | ||
*/ | ||
function renderCustomTemplate(re_render) { | ||
|
||
var template = this.inner_template; | ||
let template = this.inner_template, | ||
has_prepare_logic = typeof this.prepareRenderVariables == 'function'; | ||
|
||
if (!template) { | ||
return; | ||
return this.prepareRenderVariables(); | ||
} | ||
|
||
let that = this, | ||
|
@@ -983,7 +984,7 @@ function renderCustomTemplate(re_render) { | |
|
||
Hawkejs.series(function getRenderVariables(next) { | ||
|
||
if (!that.prepareRenderVariables) { | ||
if (!has_prepare_logic) { | ||
return next(); | ||
} | ||
|
||
|
@@ -1020,7 +1021,7 @@ function renderCustomTemplate(re_render) { | |
} | ||
|
||
if (that[Hawkejs.VARIABLES]) { | ||
render_vars = that[Hawkejs.VARIABLES].overlay(render_vars); | ||
render_vars = Hawkejs.Variables.cast(that[Hawkejs.VARIABLES], renderer).overlay(render_vars); | ||
} | ||
|
||
render_vars.self = that; | ||
|