What's New With 4.0

05/16/2024

New Features

Livewire.js 3.0 Upgrade

CBWIRE 4.0 features a complete upgrade to Livewire.js version 3, bringing modern frontend capabilities and improved performance. This major upgrade provides the foundation for all new features in this release.

Alpine.js Integration

Alpine.js is now automatically included with CBWIRE, eliminating the need for separate installation and configuration. This seamless integration provides enhanced frontend interactivity out of the box.

// wires/InteractiveComponent.bx
class extends="cbwire.models.Component" {
    data = {
        "showDetails": false,
        "message": "Click to reveal"
    };
    
    function toggleDetails() {
        data.showDetails = !data.showDetails;
    }
}

Lazy Loading Components

Improve application performance with lazy loading capabilities. Components can now be loaded on-demand, reducing initial page load times. While the component loads, a placeholder is displayed to provide visual feedback to users.

Components can define a placeholder() method that returns HTML content to display while the component is loading. This provides a better user experience during the loading process.

JavaScript Execution from Actions

Execute JavaScript directly from your component actions using the new js() method, enabling seamless server-to-client communication.

Single-Page Applications with wire:navigate

Transform your application into a single-page application using the new wire:navigate directive for seamless navigation without full page reloads.

Content Streaming with wire:stream

Stream content in real-time using the new wire:stream directive for dynamic content updates.

Smooth Transitions with wire:transition

Add smooth animations and transitions to your UI updates using the wire:transition directive. This feature enhances user experience by making elements transition in and out smoothly, rather than just popping into view.

Available modifiers include:

  • Directional: .in (appear only), .out (disappear only)

  • Duration: .duration.[?ms] (e.g., .duration.300ms)

  • Effects: .opacity (fade only), .scale (scale only)

  • Origins: .origin.top|bottom|left|right (scale origin point)

Request Bundling

Optimize performance with intelligent request bundling that reduces the number of server requests by combining multiple component updates into single requests.

Complete Engine Rewrite

CBWIRE 4.0 features a completely rewritten engine architecture providing:

  • Improved performance and reliability

  • Better component lifecycle management

  • Enhanced debugging capabilities

  • Modern development patterns

Enhancements

Lifecycle Method Improvements

Updated lifecycle methods for better consistency and clarity:

  • mount() renamed to onMount()

  • updated() renamed to onUpdate()

Configuration Cleanup

Streamlined configuration by removing deprecated settings:

  • Removed enableTurbo global setting (superseded by wire:navigate)

  • Removed throwOnMissingSetter global setting (improved error handling)

Performance Optimizations

  • Faster component rendering and updates

  • Optimized request handling with bundling

  • Improved memory usage and garbage collection

  • Enhanced component lifecycle management

Breaking Changes

Lifecycle Methods

If you're upgrading from CBWIRE 3.x, update your lifecycle methods:

Configuration Settings

Remove deprecated settings from your configuration:

Was this helpful?