githubEdit

What's New With 2.0

08/30/2022

New Features

File Upload Support

CBWIRE 2.0 introduces comprehensive file upload capabilities with built-in handling for single and multiple files.

// wires/FileUploader.cfc
component extends="cbwire.models.Component" {
    data = {
        "uploadedFile" = "",
        "uploadedFiles" = [],
        "uploadProgress" = 0
    };
    
    function processUpload() {
        if (structKeyExists(data, "uploadedFile") && len(data.uploadedFile)) {
            // Handle single file upload
            var uploadPath = expandPath("./uploads/");
            fileMove(data.uploadedFile, uploadPath & data.uploadedFile.getClientFileName());
            
            data.uploadProgress = 100;
        }
    }
    
    function processMultipleUploads() {
        if (arrayLen(data.uploadedFiles)) {
            var uploadPath = expandPath("./uploads/");
            
            for (var file in data.uploadedFiles) {
                fileMove(file, uploadPath & file.getClientFileName());
            }
            
            data.uploadProgress = 100;
        }
    }
}

Component Testing

Write comprehensive unit tests for your CBWIRE components with the new testing framework.

Custom Wires Directory

Override the default wires folder location to organize components according to your application structure.

Skip Rendering with noRender()

Prevent template rendering when you only need to update data without returning HTML.

Dirty Property Tracking

Track which properties have changed since the last render for optimized updates.

Computed Property Optimization

Computed properties now run only once per request during rendering for better performance.

Dependency Injection Support

Components now support ColdBox's dependency injection system.

Enhanced Turbo Support

Enable single-page application functionality with improved Turbo integration.

Enhancements

Template Path Flexibility

Set custom template paths for components using the this.template property.

Null Value Support

Data properties now properly support null as a valid value.

Livewire JavaScript Upgrade

Updated to Livewire JS v2.10.6 for improved client-side functionality and bug fixes.

Performance Optimizations

  • Disabled browser caching for XHR responses to ensure fresh data

  • Trimmed XHR payload by removing unnecessary data

  • Moved internal methods to Engine object to prevent naming conflicts

  • Added security by rejecting XHR requests without proper headers

Bug Fixes

Component State Management

  • Fixed reset() errors: Calling reset("someProperty") no longer causes errors

  • Preserved component IDs: Component IDs are now preserved across renders to avoid DOM diffing issues

  • Better parameter handling: Fixed missing parameters in update method calls

Browser Compatibility

  • Fixed back button issues: Browser back button now works correctly with CBWIRE components

  • Improved navigation: Better handling of browser history and navigation states

Data Integrity

  • Parameter validation: Ensured params is properly passed as an array

  • Method parameter handling: Fixed missing parameters in component method calls

Breaking Changes

This is a major version release with some breaking changes:

Component Structure

Some internal method names have changed to prevent conflicts. If you were extending or overriding internal CBWIRE methods, you may need to update your code.

XHR Security

XHR requests now require the X-Livewire header. This improves security but may affect custom AJAX implementations.

Template Resolution

The default template resolution has been improved. If you have custom template path logic, verify it still works correctly with the new resolution system.

Was this helpful?