New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unfriendly behavior when Action status message is very long. #2707
Comments
Hey @MrJoy.
The response here is pretty much "default", wouldn't you say? def update_fail_action
respond_to do |format|
flash.now[:error] = update_fail_message
format.html { render :edit, status: :unprocessable_entity }
end
end This is pretty much what we do. My question is, does a 1.6K character message really makes sense to display to the user? My proposal is to truncate that message to |
Truncation would be totally fine. I'd say -- for the same reason you imply -- that even shorter would be acceptable. I'm currently truncating any variable-length message to 100 characters. |
This issue has been marked as stale because there was no activity for the past 15 days. |
Let's truncate to 320 characters @gabrielgiroe1 |
Describe the bug
I just spent about 20 minutes trying to figure out why I couldn't get a toast with the result of an Action. It turns out the action was doing this:
And the resulting error message length was causing the session cookie to exceed 4KB. I noticed that via a warning in the browser console.
I assume this is due to how Rails handles flash messages.
Steps to Reproduce
Steps to reproduce the behavior:
e.message.length
was 1,644.)Expected behavior & Actual behavior
It would be nice if Avo would report that something went wrong and the result couldn't be presented. Or, perhaps, if it truncated the message before tossing it in the session hash (although finding an acceptable limit for that could be challenging).
It would be even nicer if the response to the action wasn't conveyed via the session object. At least, not when the response is a normal Turbo response and not a redirect or download.
Models and resource files
System configuration
Avo version: 3.6.1
Rails version: 7.1.3.2
Ruby version: 3.2.2
License type:
Are you using Avo monkey patches, overriding views or view components?
Screenshots or screen recordings
Additional context
Impact
Urgency
The text was updated successfully, but these errors were encountered: