-
-
Notifications
You must be signed in to change notification settings - Fork 6
Add support for lazy = true
component flag to enforce lazy loading by default
#212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
Co-authored-by: grantcopley <[email protected]>
Co-authored-by: grantcopley <[email protected]>
Co-authored-by: grantcopley <[email protected]>
models/Component.cfc
Outdated
variables._lazyLoad = variables.keyExists( "lazyLoad" ) && isBoolean( variables.lazyLoad ) && variables.lazyLoad ? | ||
// Check if the component has a lazy property (preferred new syntax) or lazyLoad property (legacy) | ||
variables._lazyLoad = ( variables.keyExists( "lazy" ) && isBoolean( variables.lazy ) && variables.lazy ) || | ||
( variables.keyExists( "lazyLoad" ) && isBoolean( variables.lazyLoad ) && variables.lazyLoad ) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I don't want lazyLoad = true/false, just lazy = true/false on the component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to only support lazy = true/false
property on components. Removed the lazyLoad
property support entirely and updated existing tests to use the new lazy
property. Changes made in commit e0fb55f.
lazy = true
component flag to enforce lazy loading by default
test-harness/views/lazy-demo.cfm
Outdated
<p>This page demonstrates the new <code>lazy = true</code> flag for CBWIRE components.</p> | ||
|
||
<h2>Test 1: Component with lazy = true (should be lazy loaded)</h2> | ||
<div style="border: 1px solid #ccc; padding: 10px; margin: 10px 0;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot You have to escape pound signs in cfml with double pound ##.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the pound sign escaping. Changed #ccc
to ##ccc
in all CSS color codes within the cfoutput block. Changes made in commit 6314ebc.
Co-authored-by: grantcopley <[email protected]>
Co-authored-by: grantcopley <[email protected]>
Implementation Complete: Add Flag to Always Lazy Load a Component
Successfully implemented support for a
lazy = true
flag on CBWIRE components that enforces lazy loading by default, with full override capabilities usinglazy=false
in wire() calls.✅ All Requirements Implemented
lazy = true
to be always lazy loadedlazy = true
are lazy loaded by defaultlazy=false
in wire() calls overrides component's lazy preferencelazy = true
also respect the lazy flag✅ Implementation Summary
Files Modified:
models/Component.cfc
: Updated lazy loading logic for both main components and child componentsmodels/CBWIREController.cfc
: Modified wire() method to respect component lazy preferencestest-harness/tests/specs/CBWIRESpec.cfc
: Added comprehensive test suite and updated existing teststest-harness/views/lazy-demo.cfm
: Demo page with proper CFML pound sign escapingTest Components Created:
TestAlwaysLazyComponent.cfc
: Component withlazy = true
TestParentWithLazyChild.cfc
: Parent component using lazy childTestParentWithOverride.cfc
: Parent overriding child's lazy settingTest Coverage:
lazy = true
loads lazily by defaultlazy=false
lazy = true
are lazy loadedlazy=true
parameter works correctlylazy
instead oflazyLoad
✅ Key Features
lazy = true/false
property as requestedUsage Examples
The implementation is complete, tested, and ready for production use!
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.