Skip to content

Unfriendly behavior when Action status message is very long. #2707

Closed
@MrJoy

Description

@MrJoy

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:

error("Unknown error: #{e.message}")

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:

  1. Create an action, and expose it on the resource. The action should produce a response that is very long. (In my case, e.message.length was 1,644.)
  2. Run the action.

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:

  • Community
  • Pro
  • Advanced

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

Additional context

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingTaskSomething to get done

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions