coldbox-modules / cbwire

CBWIRE is a ColdBox module that makes building reactive, modern apps easy using HTML-over-the-wire technologies and CFML.
https://cbwire.ortusbooks.com
Other
28 stars 5 forks source link

Fix child components not re-rendering properly on subsequent requests #124

Closed grantcopley closed 12 months ago

grantcopley commented 1 year ago

CBWIRE is not properly tracking child objects.

The component below should be able to do the following:

<cfscript>
    data = {
        "name": "CBWIRE",
        "toggle": true
    };

    function toggleComps() {
        data.toggle = !data.toggle;
    }

    function reload() {
        refresh();
    }
</cfscript>

<cfoutput>
    <div>
        <h1>Parent</h1>
        <div>Rendered at #now()#</div>
        <div>#name#</div>
        <button wire:click="reload">reload</button>
        <button wire:click="$refresh">$refresh</button>
        <button wire:click="toggleComps">toggle</button>
        <button wire:click="$set( 'name', 'Rocks')">change name</button>

        <cfif toggle>
            #wire( "ChildComponent" )#
        <cfelse>
            #wire( "DataBinding" )#
        </cfif>
    </div>
</cfoutput>