Skip to content
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

Potential name clashes with Avo::TurboStreamActionsHelper #3462

Open
3 of 9 tasks
dark-panda opened this issue Nov 25, 2024 · 2 comments
Open
3 of 9 tasks

Potential name clashes with Avo::TurboStreamActionsHelper #3462

dark-panda opened this issue Nov 25, 2024 · 2 comments

Comments

@dark-panda
Copy link

Describe the bug

Avo::TurboStreamActionsHelper defines Turbo Stream helper methods for #download, #flash_alerts, and #close_modal. These are very common names which can clash with other identically named Turbo Stream helper methods that may be defined by a Rails application or by other libraries. In our case, we have our own Turbo Stream helper called #close_modal and because we also do a Turbo::Streams::TagBuilder.prepend on own helpers, the two clash with each other and the Avo one ends up taking precedence as it gets included after ours do. However, because they're both identically named, one of them will inherently fail unless one of these two methods is renamed. I'd suggest renaming these methods to #avo_download, #avo_flash_alerts, and #avo_close_modal to prevent them from clashing with user applications.

Steps to Reproduce

Create your own Turbo Stream helpers in a module and prepend them into Turbo::Streams::TagBuilder.

Expected behavior & Actual behavior

Avo Turbo Stream helpers should not overwrite those found in the main app.

Models and resource files

pp/helpers/avo/turbo_stream_actions_helper.rb

System configuration

Avo version: 3.14.1

Rails version: 8.0.0

Ruby version: 3.3.6

License type:

  • Community
  • Pro
  • Advanced

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

None that would impact this particular issue, since the issue is due to prepending identically named methods into Turbo::Streams::TagBuilder.

Screenshots or screen recordings

N/A

Additional context

N/A

Impact

  • High impact (It makes my app un-usable.) -- makes functionality in our app unusable unless we modify our own method names, but this issue could also impact other libraries that have similarly named Turbo Stream helpers, so avoiding name clashes on all sides would be advisable.
  • 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.)
@adrianthedev
Copy link
Collaborator

Hmm. I see what you're saying.
We are currently engaged in a few initiatives. Are you available to send in a PR?

@dark-panda
Copy link
Author

@adrianthedev posted a first cut of a PR at #3467.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants