KonnorRogers / mrujs

UJS for modern javascript.
https://mrujs.netlify.app
MIT License
164 stars 16 forks source link

204 no contents break _everything_ #106

Closed KonnorRogers closed 2 years ago

KonnorRogers commented 3 years ago

Expected Behavior

204 no contents should request the current page

Actual Behaviour

204s do nothing.

Proposed Fix

Use morphdom to request the current page and then morph the response

KonnorRogers commented 3 years ago

Still haven't come up with a good way of solving this. Perhaps this should be on the end user to figure this out, I have a couple ideas in mind, but nothing solid.

manuelreis commented 2 years ago

@ParamagicDev do you suggest any workaround? Trying to create a link to Devise's sign out here.

KonnorRogers commented 2 years ago

@manuelreis Theres 2 possible solutions:

A.) listen for ajax:success, check event.detail.status == 204 and then issue a window.location.reload() to force a manual reload. (Not Recommended) B.) The other option is to override the default devise behavior and send back a redirect to an actual location.

I believe this should work for ya.

https://gist.github.com/ParamagicDev/8f93a71d3498265cb84ce2d665b9955a