Releases: imacrayon/alpine-ajax
v0.9.1
What's Changed
- examples/dialog.md - Add missing close button to sample html by @Fak3 in #95
- Allow $ajax to recover from aborted requests by @imacrayon in #97
New Contributors
Full Changelog: v0.9.0...v0.9.1
v0.9.0
This minor release continues to sand down some rough edges in Alpine AJAX:
-
x-target
will now initialize an Alpine component without requiringx-init
orx-data
. While this isn't a breaking change, you may want to remove unnecessaryx-init
’s in your code:<!-- Before --> <form x-init x-target="..."> </form> <tbody x-data> <a x-target="..."> </tbody> <!-- After --> <form x-target="..."> </form> <tbody> <a x-target="..."> </tbody>
Check out all the attributes we were able to remove from the documentation in this commit: 9949ab5
-
We've fixed some edge cases around response caching. Now Alpine AJAX can further reduce the number of requests hitting the server when multiple components fetch from the same endpoint.
Here's a secret for anybody reading these release notes: I just recorded a 30min walkthrough on how to build apps with Alpine AJAX. It'll go up on the documentation site soon but you can watch it here now: https://www.youtube.com/watch?v=vNiZyFVmoOI
Full Changelog: v0.8.2...v0.9.0
v0.8.2
v0.8.1
v0.8.0
This update changes the behavior of the special _self
keyword when using status code modifiers on x-target
:
<form x-target="my_form" x-target.3xx="_self">
Previously this code would trigger a full page reload when the form request responded with a redirect. Now, it will only trigger a full page reload if the redirect's location is a URL not matching the current page. In the case that this form does redirect back to the current page, like to show validation errors, my_form
will be used as the target instead.
This new behavior is documented here: https://alpine-ajax.js.org/reference/#_self-special-exception
In cases where you want the page to reload no matter what (the old _self
behvaior), you can use _top
instead.
v0.7.1
A small release to fixes a few issues related to the x-target
status code modifier.
- The mock server was updated to respond with a status code. (You'll be able to modify this status code in the next release.)
aria-busy
is removed from "old" targets when a status code modifier causes the targets to change.
v0.7.0
This release provides new APIs for overriding AJAX request options and handling responses.
What's New
x-target
response code modifiers: You can use modifiers likex-target.422
orx-target.3xx
to change targets based on the status code returned from a response. Learn more in the documentation.ajax:send
: This event fires when an AJAX request is issued.$event.detail
contains the request’s options, modifying these options will override the underlyingfetch
call.ajax:sent
: This event replacesajax:after
.
What's Changes
ajax:after
now fires after all merging has settled.$event.detail
now contains aresponse
object that matches the old$event.detail
and arender
array that includes all rendered targets.- The
followRedirects
config option and thex-target.follow
modifier have been removed in favor of using response code modifiers. You can match the same behavior asx-target.follow
usingx-target x-target.3xx="_self"
.
Full Changelog: v0.6.1...v0.7.0
v0.6.1
What's Fixed
- Fixed a regression where elements with
x-sync
were being removed from the DOM if a response didn't contain a matching target. (Thanks for reporting @ma2thieu)
What's Changed
New Contributors
Full Changelog: v0.6.0...v0.6.1
v0.6.0
This update refactors a lot of the Alpine AJAX internals to make it more compact and predictable. We've shaved some code to make room for new automatic pre-fetching and optimistic UI features coming soon. We've also sorted out some edge cases and improved compatible with Alpine's reactivity features.
Breaking Change
There's a single breaking change in this release: $ajax
no longer inherits options from other Alpine AJAX attributes. Mixing $ajax
with attributes has been a point of confusion and code complexity, so we're simplifying how things work.
If you have an element that's mixing $ajax
with attributes like this:
<div @click="$ajax('https://...')" x-target.push="my_target" x-headers="{ 'x-csrf': 'token' }">
Refactor to this:
<div @click="$ajax('https://...', {
target: 'my_target',
history: 'push',
headers: { 'x-csrf': 'token' }
})">
The Infinite Scroll Example previously mixed x-target
and $ajax
to handle pagination, so if you've used that example in the past, be sure to update your code.
What's Changed
- Polyfills for
HTMLFormElement.requestSubmit
andSubmitEvent.submitter
have been removed since they have broad browser support. $ajax
emits all the same lifecycle events asx-target
- The
x-target
"submit" and "click" events are delegated to event listeners on thewindow.document
. These global listeners can be toggled by callingAlpine.ajax.stop()
andAlpine.ajax.start()
if you need to do that for some reason. - Renamed “Missing Target”
Error
to “TargetError” - Renamed “Missing ID”
Error
to “IDError”
Additions
- Added
x-target:dynamic
for dynamically generating target IDs - Added
x-merge:dynamic
for dynamically generating a merge strategy - Added
Alpine.ajax.stop()
andAlpine.ajax.start()
to globally disable/enablex-target
event listeners
Fixes
- Fixed an edge case where form controls named
id
would break rendering (#64) - Fixed URL query parameters not merging correctly when changing history state
x-headers
now respectsx-data
values
Full Changelog: v0.5.1...v0.6.0