Skip to content

Commit

Permalink
Cleanup unnecessary variables available to templates to avoid potenti…
Browse files Browse the repository at this point in the history
…al collisions #126
  • Loading branch information
Grant Copley committed Sep 22, 2023
1 parent 255685d commit 78df744
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions models/renderer/RendererEncapsulator.cfm
@@ -1,12 +1,4 @@
<cfscript>
httpRequestData = getHTTPRequestData();
childWireInstanceIndex = 0;
serverMemoChildren = httpRequestData.content.len() ? deserializeJson( httpRequestData.content ).serverMemo.children : {};
isSingleFileComponent = attributes.cbwirecomponent.getParent().isSingleFileComponent();
variables[ "getInstance" ] = attributes.cbwireComponent.getInstance;
variables[ "data" ] = attributes.cbwireComponent.getDataProperties();
Expand All @@ -15,21 +7,14 @@
variables[ "prc" ] = attributes.event.getPrivateCollection();
functions = getMetaData( attributes.cbwirecomponent.getParent() ).functions;
functions.each( function( cbwireFunction ) {
getMetaData( attributes.cbwirecomponent.getParent() ).functions.each( function( cbwireFunction ) {
variables[ cbwireFunction.name ] = function() {
return invoke( attributes.cbwireComponent.getParent(), cbwireFunction.name, arguments );
};
} );
variables.wire = function( componentName, parameters = {} ) {
variables[ "wire" ] = function( componentName, parameters = {} ) {
var lineNumber = callStackGet()[ 2 ].lineNumber;
// if ( structKeyExists( serverMemoChildren, attributes.args.parent.getID() & "-" & lineNumber ) ) {
// var element = serverMemoChildren[ attributes.args.parent.getID() & "-" & lineNumber ];
// return "<#element.tag# wire:id=""#element.id#""></#element.tag#>";
// }
var comp = application.wirebox.getInstance( "CBWireService@cbwire" )
.getComponentInstance( arguments.componentName )
.startup();
Expand All @@ -40,17 +25,16 @@
.renderIt();
};
variables.entangle = function( required prop ) {
variables[ "entangle" ] = function( required prop ) {
var cbwireService = application.wirebox.getInstance( "CBWireService@cbwire" );
return cbwireService.entangle( argumentCollection=arguments );
};
variables.args = attributes.args;
structAppend( variables, attributes.cbwireComponent.getComputedPropertiesWithCaching() );
structAppend( variables, attributes.args );
//structAppend( variables, attributes.args.computed );
include "#attributes.cbwireTemplate#";
</cfscript>

0 comments on commit 78df744

Please sign in to comment.