|
| 1 | ++++ |
| 2 | +title = "Aurelia 2 Beta 25: Binding updates, HTML Dialog, State Middleware and Router Rename" |
| 3 | +authors = ["Dwayne Charrington"] |
| 4 | +description = "Beta 25 is here with async computed observers, native html dialog, state middleware, router rename, and more." |
| 5 | +date = 2025-07-11T10:00:00Z |
| 6 | +lastmod = 2025-07-11T10:00:00Z |
| 7 | +tags = ["aurelia2", "release"] |
| 8 | ++++ |
| 9 | + |
| 10 | +Beta 25 is more than just another beta release. We've transformed computed observers from sync to async, swapped in a native HTML dialog, renamed our router packages, and added middleware support into state management. On top of that there are new utilities for recurring tasks, memoized selectors, path generation, context-aware value converters, and over a dozen bug fixes. |
| 11 | + |
| 12 | +## Breaking Changes |
| 13 | + |
| 14 | +### Binding - computed observers notify asynchronously by default |
| 15 | +Computed observers used to fire change notifications as soon as a dependency changed. Now they wait until the next tick before notifying subscribers. |
| 16 | + |
| 17 | +This switch from sync to async: |
| 18 | + |
| 19 | +- Ensures change notifications happen at predictable times instead of in the middle of render or update cycles |
| 20 | +- Avoids platform limitations where requestAnimationFrame might not make sense (SSR, WebWorkers, custom hosts) |
| 21 | +- Batches computed updates into a single tick-based queue rather than the old raf queue |
| 22 | + |
| 23 | +In Beta 25 you can import the queue API from the runtime package: |
| 24 | + |
| 25 | +```ts |
| 26 | +import { |
| 27 | + Task, |
| 28 | + RecurringTask, |
| 29 | + getRecurringTasks, |
| 30 | + queueTask, |
| 31 | + queueAsyncTask, |
| 32 | + queueRecurringTask, |
| 33 | + runTasks, |
| 34 | + tasksSettled, |
| 35 | + TaskAbortError, |
| 36 | + TaskStatus |
| 37 | +} from 'aurelia'; |
| 38 | +``` |
| 39 | + |
| 40 | +Example usage: |
| 41 | + |
| 42 | +```ts |
| 43 | +import { queueTask, tasksSettled } from 'aurelia'; |
| 44 | + |
| 45 | +queueTask(() => { |
| 46 | + console.log('all computed updates flushed'); |
| 47 | +}); |
| 48 | + |
| 49 | +await tasksSettled(); |
| 50 | +``` |
| 51 | + |
| 52 | +Given the extent of these changes, it is possible that there might be unintended side effects or issues that we have not run into. This is why we are creating some space in releases before release candidate. If you encounter any issues around observation, please do not hesitate to file an issue on our GitHub repository. |
| 53 | + |
| 54 | +### Dialog – native HTML `<dialog>` is now the default renderer |
| 55 | +We ditched the old overlay hacks and made the browser's `<dialog>` element our go-to. |
| 56 | + |
| 57 | +Highlights: |
| 58 | + |
| 59 | +- Overlay is optional - skip it if you don't need a backdrop |
| 60 | +- Animations via CSS show/hide options, globally or per `open()` call |
| 61 | +- `DefaultDialogConfiguration` renamed to `DialogConfigurationClassic` |
| 62 | +- Internal dialog event manager and animator APIs are now private |
| 63 | + |
| 64 | +Opening a dialog looks like: |
| 65 | + |
| 66 | +```ts |
| 67 | +dialogService.open({ |
| 68 | + component: MyDialog, |
| 69 | + options: { show: 'fadeIn 200ms ease', hide: 'fadeOut 150ms ease' } |
| 70 | +}); |
| 71 | +``` |
| 72 | + |
| 73 | +## Router - clearer package names |
| 74 | +We renamed the router packages and cleared up some ambiguity around routing packages. |
| 75 | + |
| 76 | +- `@aurelia/router-lite` becomes `@aurelia/router` (default) |
| 77 | +- `@aurelia/router` becomes `@aurelia/router-direct` |
| 78 | + |
| 79 | +Just update your imports and you're good to go. |
| 80 | + |
| 81 | +## Vite Plugin – upgrade to Vite 7 |
| 82 | +Our Vite plugin now targets Vite 7. You'll pick up the latest builder features and fixes. Older Vite versions will still work, but we recommend bumping to v7. |
| 83 | + |
| 84 | +## New Features |
| 85 | + |
| 86 | +- **queueRecurringTask** |
| 87 | + Schedule a callback every tick until you cancel it. Perfect for polling or continuous checks. |
| 88 | +- **State middleware support** |
| 89 | + Hook into every dispatched action to log, measure or transform before reducers run. |
| 90 | +- **Memoized selectors** |
| 91 | + Create selectors that cache results until inputs change for zero-waste state reads. |
| 92 | +- **Path generation** |
| 93 | + Build URLs from named routes instead of string building. |
| 94 | +- **Value converter context** |
| 95 | + Value converters receive binding source, target element and more so you can write smarter converters. |
| 96 | + |
| 97 | +## 🐞 Bug Fixes |
| 98 | + |
| 99 | +Over a dozen fixes that smooth out rough edges: |
| 100 | + |
| 101 | +- **au-compose** stops re-composing when detached |
| 102 | +- **Binding** interpolation reacts to array mutations and skips updates once unbound |
| 103 | +- **Queue** cancellation no longer triggers unhandledRejection |
| 104 | +- **Runtime-HTML** repeater avoids unnecessary DOM churn |
| 105 | +- **i18n** translation binding checks `isBound` to prevent early updates |
| 106 | + |
| 107 | +Other fixes cover Vite build mode detection, object property wrapping, URI decoding in route-recognizer and more. |
| 108 | + |
| 109 | +## Storybook |
| 110 | + |
| 111 | +Some of you might have already known, but we've had a Storybook plugin for Aurelia for a little while now, but it only worked with Vite applications. The `@aurelia/storybook` package has been updated to work with Webpack too. We also added in some example stories and made it compatible with the latest Storybook 9 release https://github.com/aurelia/storybook/commit/8059f105218278a9e01ade919adea7ab9acb031c |
| 112 | + |
| 113 | +## Aurelia CLI |
| 114 | + |
| 115 | +The CLI that powers the `npx makes aurelia` scaffolding has also undergone some improvements. |
| 116 | + |
| 117 | +- Added support for TailwindCSS into the app creation process https://github.com/aurelia/new/pull/122 |
| 118 | +- Added support for Storybook (Webpack and Vite apps) https://github.com/aurelia/new/pull/124 |
| 119 | +- When creating a new Aurelia 2 application with routing, there are default routes https://github.com/aurelia/new/pull/125 |
| 120 | +- We fixed our Shadow DOM implementation to work for all bundlers https://github.com/aurelia/new/pull/126 |
| 121 | + |
| 122 | +## Documentation updates |
| 123 | + |
| 124 | +We are continually fine-tuning and improving the docs for Aurelia 2. In this release we made some nice improvements to the docs, to the point where listing all of the changes we made would require a separate update. A special thank you to the community for providing us valuable feedback and filing issues around this crucial aspect of Aurelia. |
| 125 | + |
| 126 | +## Welcome New Contributor |
| 127 | + |
| 128 | +Shout-out to [@graycrow](https://github.com/graycrow) for their [first PR](https://github.com/aurelia/aurelia/pull/2171) on translation binding. |
| 129 | + |
| 130 | +## Full Changelog |
| 131 | + |
| 132 | +- [https://github.com/aurelia/aurelia/compare/v2.0.0-beta.24...v2.0.0-beta.25](https://github.com/aurelia/aurelia/compare/v2.0.0-beta.24...v2.0.0-beta.25) |
| 133 | +- [https://github.com/aurelia/aurelia/releases/tag/v2.0.0-beta.25](https://github.com/aurelia/aurelia/releases/tag/v2.0.0-beta.25) |
| 134 | + |
| 135 | +## Upgrade Guide |
| 136 | + |
| 137 | +1. Update your `@aurelia/*` dependencies to `2.0.0-beta.25` and Vite to v7 |
| 138 | +2. Change computed observer imports if you use the queue API |
| 139 | +3. Rename router package imports |
| 140 | +4. Test your app and join us on Discord if you hit issues |
| 141 | + |
| 142 | +Beta 25 is packed with foundational changes that set the stage for smoother, more predictable apps as we head towards rleease candidate. Dive in and let us know what you build. |
| 143 | + |
| 144 | +If you have any questions or need assistance, please join us on [Discord](https://discord.gg/TPV3cvCZhz) and reach out to the team. |
0 commit comments