redirection after a POST, PUT, or PATCH

58 views
Skip to first unread message

Brandon Casci

unread,
Dec 19, 2020, 9:33:38 AM12/19/20
to unp...@googlegroups.com
Hello,

I’m coming from a Rails and Turbolinks background.

The default way to handle a redirection response is to have Turbolinks fetch the document from the new url, by way of a server generated JavaScript response, and then a Turbolinks will update the current document body with the new document body. The user doesn’t experience a full page reload.

From what I understand so far about Unpoly, a redirect has no special treatment by default. The browser visits the new location as it normally would and does a full page refresh. At least that’s what I’m seeing after a form post that creates a record, and then send the user to a different screen. Is this expected? Are there any features in Unpoly one could use to change this? If not, would one be going against the opinions or conventions of Unpoly by changing this behavior? It’s an excellent framework, so I prefer not to stray from its philosophy, I just need to understand what the philosophy is.

Adam Daniels

unread,
Dec 19, 2020, 10:24:28 AM12/19/20
to unp...@googlegroups.com
Are you using an up-target on your form element? I think Turbolinks is implicit in handling this but for Unpoly 1 you need to be explicit. 

https://unpoly.com/form-up-target

Sent from my iPhone

On Dec 19, 2020, at 9:33 AM, Brandon Casci <brando...@gmail.com> wrote:

Hello,

I’m coming from a Rails and Turbolinks background.

The default way to handle a redirection response is to have Turbolinks fetch the document from the new url, by way of a server generated JavaScript response, and then a Turbolinks will update the current document body with the new document body. The user doesn’t experience a full page reload.

From what I understand so far about Unpoly, a redirect has no special treatment by default. The browser visits the new location as it normally would and does a full page refresh. At least that’s what I’m seeing after a form post that creates a record, and then send the user to a different screen. Is this expected? Are there any features in Unpoly one could use to change this? If not, would one be going against the opinions or conventions of Unpoly by changing this behavior? It’s an excellent framework, so I prefer not to stray from its philosophy, I just need to understand what the philosophy is.

--
You received this message because you are subscribed to the Google Groups "unpoly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unpoly+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unpoly/CACRQB3JNY8YoefWmnVJ71uA_C6ijR5NdoHULSR4Y4V2PMjZ4rw%40mail.gmail.com.

Brandon Casci

unread,
Dec 19, 2020, 10:59:29 AM12/19/20
to unp...@googlegroups.com
Oh nice. I should have experimented a little more before asking. I didn't notice that up-target would still work after following a redirect, and it does. Thanks for pointing that out. Being explicit is OK, and it looks there are options on the way in version 2 if you want more implicit behavior. 
Reply all
Reply to author
Forward
0 new messages