Read more

Unpoly 3.2.0 released

Henning Koch
May 25, 2023Software engineer at makandra GmbH

Addressing an important caching issue

Unpoly 3.2.0 no longer cache responses with an empty body. In particular responses with 304 Not Modified are no longer cached when using conditional requests Show snapshot .

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show snapshot

As this issue could cause errors when rendering, we recommend all Unpoly 3 users to upgrade.

Using the server response that closed an overlay

When an overlay closes in reaction to a server response, no content from that response is rendered.

Sometimes you do need to access the discarded response, e.g. to render its content in another layer.
For this you can now access response via the { response } property of the up:layer:accepted Show snapshot and up:layer:dismissed Show snapshot events.

For example, the link link opens an overlay with a form to create a new company (/companies/new).
After successful creation the form redirects to the list of companies (/companies). In that case
we can use the HTML from the response and render it into the parent layer:

<a href="/companies/new"
   up-on-accepted="up.render('.companies', { response: event.response }">
  New company

The { response } property is available whenever a server response causes an overlay to close:

Rendering up.Response Show snapshot objects

If you have manually fetched content from the server, you can now pass an up.Response Show snapshot object as a { response } option to render its contents:

let response = await up.request('/path')
up.render({ target: '.target', response })

The various ways to provide HTML to rendering functions are now summarized on a new documentation page Show snapshot .

Other changes

  • You can now use [up-href] Show snapshot without also setting [up-follow] or [up-target]

  • Date inputs are again validated on change instead of blur.

    In Unpoly 3.0 this defaulted to blur because desktop date pickers emit a change event whenever the user changes a date component (day, month, year). Unfortunately this change caused issues with mobile date pickers as well as JavaScript date pickers.

    If you prefer validating on blur, you can restore the behavior of Unpoly 3.0 by configuring up.form.config.watchChangeEvents Show snapshot .

  • Rendering functions now have a better error message when referring to detached elements or when referring to non-existing layers.

  • The results of up.Response#fragments are no longer cached to preserve memory.

Posted by Henning Koch to makandra dev (2023-05-25 16:21)