Skip to content

Releases: imacrayon/alpine-ajax

v0.9.1

02 Oct 03:18
d7bf8dd
Compare
Choose a tag to compare

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

  • @Fak3 made their first contribution in #95

Full Changelog: v0.9.0...v0.9.1

v0.9.0

21 Aug 21:53
Compare
Choose a tag to compare

This minor release continues to sand down some rough edges in Alpine AJAX:

  1. x-target will now initialize an Alpine component without requiring x-init or x-data. While this isn't a breaking change, you may want to remove unnecessary x-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

  2. 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

17 Aug 22:58
Compare
Choose a tag to compare

This patch release fixes an edge case where the wrong element with autofocus could receive focus when multiple elements having autofocus children are targeted.

v0.8.1

17 Aug 16:45
Compare
Choose a tag to compare

Alpine AJAX automatically disables form submit buttons while an AJAX request is in flight. This patch release fixes an issue where submit buttons are not properly re-enabled when a request is aborted mid-flight.

v0.8.0

05 Aug 15:12
Compare
Choose a tag to compare

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

09 Jul 14:51
Compare
Choose a tag to compare

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

14 Jun 20:40
Compare
Choose a tag to compare

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 like x-target.422 or x-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 underlying fetch call.
  • ajax:sent: This event replaces ajax:after.

What's Changes

  • ajax:after now fires after all merging has settled. $event.detail now contains a response object that matches the old $event.detail and a render array that includes all rendered targets.
  • The followRedirects config option and the x-target.follow modifier have been removed in favor of using response code modifiers. You can match the same behavior as x-target.follow using x-target x-target.3xx="_self".

Full Changelog: v0.6.1...v0.7.0

v0.6.1

07 Jun 15:12
Compare
Choose a tag to compare

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

  • @eydun made their first contribution in #75

Full Changelog: v0.6.0...v0.6.1

v0.6.0

27 Apr 18:15
Compare
Choose a tag to compare

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 and SubmitEvent.submitter have been removed since they have broad browser support.
  • $ajax emits all the same lifecycle events as x-target
  • The x-target "submit" and "click" events are delegated to event listeners on the window.document. These global listeners can be toggled by calling Alpine.ajax.stop() and Alpine.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() and Alpine.ajax.start() to globally disable/enable x-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 respects x-data values

Full Changelog: v0.5.1...v0.6.0

v0.5.1

07 Mar 16:36
Compare
Choose a tag to compare

This patch release fixes the autofocus algoritm so that hidden [autofocus] & [x-autofocus] elements will not be given focus.